Map<String, TileDataSet> buildTileDataSetMap()
throws IOException, UnknownCRSException {
Map<String, TileDataSet> map = new HashMap<String, TileDataSet>();
for ( GdalTileStoreJaxb.TileDataSet tds : cfg.getTileDataSet() ) {
String id = tds.getIdentifier();
if ( id == null ) {
id = new File( tds.getFile() ).getName();
}
File file = location.resolveToFile( tds.getFile() );
if ( !file.exists() ) {
LOG.warn( "File {} does not exist, skipping.", file );
continue;
}
Dataset gdalDataset = gdal.OpenShared( file.toString() );
try {
Envelope env = GdalUtils.getEnvelopeAndCrs( gdalDataset, "EPSG:28992" ).getEnvelope();
if ( env == null ) {
throw new ResourceInitException( "No envelope information could be read via GDAL." );
}
LOG.debug( "Envelope from GDAL was {}.", env );
map.put( id, builder.buildTileDataSet( tds, location, env ) );
} finally {
gdalDataset.delete();
}
}
return map;
}