/** * Load a raster from a stream. * * @param in * @param options * map with options for the raster writer * @return the loaded raster as an AbstractRaster * @throws IOException */ public static AbstractRaster loadRasterFromStream( InputStream in, RasterIOOptions options ) throws IOException { RasterReader reader = getRasterReader( options ); if ( reader == null ) { log.error( "couldn't find raster reader for stream" ); throw new IOException( "couldn't find raster reader for stream (" + options + ")" ); } return reader.load( in, options ); }
/** * Load a raster from a file. * * @param filename * the filename of the raster * @param options * @return the loaded raster as an AbstractRaster * @throws IOException */ public static AbstractRaster loadRasterFromFile( File filename, RasterIOOptions options, ResourceMetadata<Coverage> metadata ) throws IOException { RasterReader reader = getRasterReader( filename, options ); if ( reader == null ) { log.error( "couldn't find raster reader for " + filename ); throw new IOException( "couldn't find raster reader" ); } AbstractRaster cov = reader.load( filename, options ); cov.setMetadata( metadata ); return cov; }
/** * loads the raster * * @param tileBaseDir * @return the loaded simpleraster * @throws IOException */ public AbstractRaster loadRaster( String tileBaseDir ) throws IOException { File file = new File( getFullFileName( tileBaseDir ) ); RasterReader reader = new IIORasterReader(); RasterIOOptions options = RasterIOOptions.forFile( file, getEnvelope() ); return reader.load( file, options ); }