/** * Save a raster to a file. * * @param raster * @param filename * @throws IOException */ public static void saveRasterToFile( AbstractRaster raster, File filename ) throws IOException { saveRasterToFile( raster, filename, new RasterIOOptions() ); }
@Override public AbstractRaster load( InputStream stream, RasterIOOptions options ) throws IOException { BufferedReader reader = new BufferedReader( new InputStreamReader( stream ) ); RasterIOOptions nOpts = options; if ( nOpts == null ) { nOpts = new RasterIOOptions(); } setID( nOpts ); return createSimpleRaster( reader, nOpts ); }
/** * Return a RasterIOOption object with the format set according to the given file. * * @param file * @return RasterIOOption proper format. */ public static RasterIOOptions forFile( File file ) { RasterIOOptions result = new RasterIOOptions(); String ext = FileUtils.getFileExtension( file ); result.add( OPT_FORMAT, ext ); return result; }
@Override public void write( OutputStream out ) throws IOException { RasterIOOptions options = new RasterIOOptions(); // lets fake GeoTiff until we have a real GeoTiff writer (TODO) if ( format.equalsIgnoreCase( "GeoTiff" ) ) { options.add( RasterIOOptions.OPT_FORMAT, "tiff" ); } else { options.add( RasterIOOptions.OPT_FORMAT, format ); } RasterFactory.saveRasterToStream( result, out, options ); }
/** * Return a RasterIOOption object with the format set according to the given file with an optional * {@link RasterGeoReference}. * * @param file * @param envelope * @return RasterIOOption proper format. */ public static RasterIOOptions forFile( File file, RasterGeoReference envelope ) { RasterIOOptions result = new RasterIOOptions( envelope ); String ext = FileUtils.getFileExtension( file ); result.add( OPT_FORMAT, ext ); result.add( READ_WLD_FILE, null ); return result; }
RasterIOOptions opts = options; if ( opts == null ) { opts = new RasterIOOptions( ref ); } else { RasterGeoReference defRef = options.getRasterGeoReference();
DataType noDataType = DataType.fromString( dataType ); RasterIOOptions options = new RasterIOOptions( originLocation ); options.add( RasterIOOptions.OPT_FORMAT, inputType ); options.add( RasterIOOptions.CRS, crs );
private RasterIOOptions getOptions( MultiResolutionRasterConfig config, ICRS parentCrs ) { RasterIOOptions opts = new RasterIOOptions(); if ( config.getStorageCRS() != null ) { opts.add( "CRS", config.getStorageCRS() ); } else { opts.add( "CRS", parentCrs.getAlias() ); } return opts; }
/** * Save a raster to a file. * * @param raster * @param filename * @param options * map with options for the raster writer * @throws IOException */ public static void saveRasterToFile( AbstractRaster raster, File filename, RasterIOOptions options ) throws IOException { RasterIOOptions opts = new RasterIOOptions(); opts.copyOf( options ); if ( !opts.contains( RasterIOOptions.OPT_FORMAT ) ) { String format = FileUtils.getFileExtension( filename ); opts.add( RasterIOOptions.OPT_FORMAT, format ); } RasterWriter writer = getRasterWriter( raster, opts ); if ( writer == null ) { log.error( "couldn't find raster writer for " + filename ); throw new IOException( "couldn't find raster writer" ); } writer.write( raster, filename, options ); }
LOG.debug( "Found following files: \n{}", coverageFiles.toString() ); RasterIOOptions opts = new RasterIOOptions(); opts.copyOf( options );
LOG.debug( "Found following files: \n{}", coverageFiles.toString() ); RasterIOOptions opts = new RasterIOOptions(); opts.copyOf( options );
final RasterIOOptions options = new RasterIOOptions(); options.copyOf( this.rasterOptions ); options.add( RasterIOOptions.CRS, dstSRS.getAlias() );
imageIndex = rasterFile.getImageIndex(); try { RasterIOOptions rOptions = new RasterIOOptions(); rOptions.copyOf( options ); if ( config.getOriginLocation() != null ) {
GridFileReader reader = new GridFileReader(); RasterIOOptions options = new RasterIOOptions(); options.setNoData( noDatas ); AbstractRaster filteredRaster = reader.load( tmpGridFile, options );
RasterIOOptions opts = new RasterIOOptions(); opts.add( IMAGE_INDEX, "" + i ); opts.add( OPT_FORMAT, "tiff" );
private AbstractRaster loadFromReader( IIORasterDataReader reader, RasterIOOptions options ) { width = reader.getColumns(); height = reader.getRows(); RasterIOOptions opts = new RasterIOOptions(); opts.copyOf( options ); setID( opts );