/** * Returns new RasterGeoReference with the origin set to the min[0],max[1] of the envelope but other values are * taken from this instance. Attention, the resulting origin is snapped to the location (center/outer) of the * underlying grid, so the min[0] and max[1] values are only approximations to the new origin! * * @param envelope * to get the origin from. * @return new RasterGeoReference or <code>null</code> if the envelope is <code>null</code> */ public RasterGeoReference createRelocatedReference( Envelope envelope ) { return this.createRelocatedReference( location, envelope ); }
@Override public RasterGeoReference getGeoReference() { return super.getGeoReference().createRelocatedReference( OriginLocation.OUTER ); }
if ( worldFile != null ) { worldFile = worldFile.createRelocatedReference( OriginLocation.OUTER );
private void instantiate( int targetColumns, int targetRows, Envelope rasterEnvelope, RasterGeoReference geoRef, File gridFile, RasterDataInfo dataInfo ) { synchronized ( LOCK ) { if ( rasterEnvelope == null ) { throw new NullPointerException( "The grid writer needs an envelope to work with." ); } if ( geoRef == null ) { throw new NullPointerException( "The grid writer needs a raster georeference to work with." ); } this.envelope = geoRef.relocateEnvelope( OriginLocation.OUTER, rasterEnvelope ); this.columns = targetColumns; this.rows = targetRows; this.geoRef = geoRef.createRelocatedReference( OriginLocation.OUTER ); int[] rasterCoordinate = this.geoRef.getSize( this.envelope ); this.gridFile = gridFile; // if ( this.gridFile != null && !this.gridFile.exists() ) { // this.gridFile.createNewFile(); // } this.dataInfo = dataInfo; this.tilesInFile = columns * rows; this.tileRasterWidth = Rasters.calcTileSize( rasterCoordinate[0], columns ); this.tileRasterHeight = Rasters.calcTileSize( rasterCoordinate[1], rows ); // this tile data does not need to be cached. updateForRasterSize(); } }
new RasterRect( size2, size2, outWidth, outHeight ), null ); RasterGeoReference rasterReference = currentRaster.getRasterReference().createRelocatedReference( envelope );
@Override public SimpleRaster getSubRaster( Envelope envelope, BandType[] bands, OriginLocation targetLocation ) { // rb: testing for envelope equality can lead to a memory leak, because the memory can not be freed. RasterRect rasterRect = getRasterReference().convertEnvelopeToRasterCRS( envelope ); RasterGeoReference rasterReference = getRasterReference().createRelocatedReference( targetLocation, envelope ); // RasterData view = getReadOnlyRasterData().getSubset( rasterRect, bands ); // rb: don't need to get a readonly raster data, because it will be filled with data later. RasterData view = getRasterData().getSubset( rasterRect, bands ); return new SimpleRaster( view, envelope, rasterReference, metadata ); }
throws IOException { RasterGeoReference rasterReference = raster.getRasterReference().createRelocatedReference( OriginLocation.OUTER ); Envelope renv = raster.getRasterReference().relocateEnvelope( OriginLocation.OUTER, raster.getEnvelope() );
int columns = (int) Math.ceil( ( (double) rasterWidth ) / tileWidth ); int rows = (int) Math.ceil( (double) rasterHeight / tileHeight ); RasterGeoReference geoRef = geoReference.createRelocatedReference( OriginLocation.OUTER ); readValues = new CacheInfoFile( geoRef, rows, columns, tileWidth, tileHeight, dataInfo, rasterWidth, rasterHeight, null, 0 ); readValues.getRasterHeight(), readValues.getDataInfo(), readValues.getGeoReference().createRelocatedReference( OriginLocation.OUTER ) ) );
SimpleRaster simpleRaster = raster.getAsSimpleRaster(); RasterGeoReference rasterReference = simpleRaster.getRasterReference().createRelocatedReference( OriginLocation.OUTER ); String newLine = System.getProperty( "line.separator" ); writer.write( "ncols " + simpleRaster.getColumns() + newLine );
SimpleRaster simpleRaster = raster.getAsSimpleRaster(); RasterGeoReference rasterReference = simpleRaster.getRasterReference().createRelocatedReference( OriginLocation.CENTER );
RasterGeoReference tileRasterReference = this.geoRef.createRelocatedReference( tileEnvelope );
RasterGeoReference ref = getRasterReference().createRelocatedReference( targetLocation, env );
/** * Read a raster from the grid file at location (row,column). * * @param columnId * * @param rowId * * @return the read raster or null if it could not be read. * @throws IOException */ public AbstractRaster getTile( int columnId, int rowId ) throws IOException { Envelope tileEnvelope = getTileEnvelope( columnId, rowId ); RasterGeoReference tileRasterReference = RasterGeoReference.create( OriginLocation.OUTER, tileEnvelope, infoFile.getTileRasterWidth(), infoFile.getTileRasterHeight() ); RasterRect tileRect = getGeoReference().createRelocatedReference( OriginLocation.OUTER ).convertEnvelopeToRasterCRS( tileEnvelope ); TileOffsetReader tReader = new TileOffsetReader( this, tileRect ); ByteBufferRasterData tileData = RasterDataFactory.createRasterData( infoFile.getTileRasterWidth(), infoFile.getTileRasterHeight(), getRasterDataInfo(), tReader, false ); SimpleRaster tile = new SimpleRaster( tileData, tileEnvelope, tileRasterReference, null ); return tile; }