/** * Returns an Envelope for a raster with given size and given x,y raster location. * * The calculation considers the origin and resolution of the this raster. * * @param rasterRect * defining the x,y raster coordinates (as integers) as well as the width and height of the raster. * @param crs * the coordinate system for the envelope * * @return the calculated envelope */ public Envelope getEnvelope( RasterRect rasterRect, ICRS crs ) { return getEnvelope( location, rasterRect, crs ); }
/** * Returns an Envelope for a raster with given size. * * The calculation considers the origin and resolution of the raster. * * @param width * in raster coordinates * @param height * in raster coordinates * @param crs * the coordinate system for the envelope * * @return the calculated envelope */ public Envelope getEnvelope( int width, int height, ICRS crs ) { return getEnvelope( location, width, height, crs ); }
/** * @param geoReference * @param rows * @param columns * @param tileRasterWidth * @param tileRasterHeight * @param dataInfo */ public GridMetaInfoFile( RasterGeoReference geoReference, int rows, int columns, int tileRasterWidth, int tileRasterHeight, RasterDataInfo dataInfo ) { this.geoReference = geoReference; this.tileRasterWidth = tileRasterWidth; this.tileRasterHeight = tileRasterHeight; this.columns = columns; this.rows = rows; this.dataInfo = dataInfo; /* rb: crs null, use the default crs */ // the outer envelope envelope = geoReference.getEnvelope( OriginLocation.OUTER, tileRasterWidth * columns, tileRasterHeight * rows, null ); }
/** * Returns an Envelope for a raster with given size. * * The calculation considers the origin and resolution of the raster. * * @param targetLocation * of the origin, specifies if the the newly created envelope should consider the origin located at the * OUTER or CENTER of a pixel. * @param width * in raster coordinates * @param height * in raster coordinates * @param crs * the coordinate system for the envelope * * @return the calculated envelope */ public Envelope getEnvelope( OriginLocation targetLocation, int width, int height, ICRS crs ) { return getEnvelope( targetLocation, new RasterRect( 0, 0, width, height ), crs ); }
/** * Calculates the envelope for a tile at a given position in the grid. * * @param column * column , must be in the range [0 ... #columns - 1] * @param row * row , must be in the range [0 ... #rows - 1] * @return the tile's envelope */ protected Envelope getTileEnvelope( int column, int row ) { int xOffset = column * tileRasterWidth; int yOffset = row * tileRasterHeight; RasterRect rect = new RasterRect( xOffset, yOffset, tileRasterWidth, tileRasterHeight ); return this.geoRef.getEnvelope( rect, null ); // double xOffset = column * tileWidth; // double yOffset = ( rows - row - 1 ) * tileHeight; // // double minX = envelope.getMin().get0() + xOffset; // double minY = envelope.getMin().get1() + yOffset; // double maxX = minX + tileWidth; // double maxY = minY + tileHeight; // // return geomFac.createEnvelope( minX, minY, maxX, maxY, envelope.getCoordinateSystem() ); }
/** * Apply the given kernel to the given raster */ public void run() { long time = currentTimeMillis(); Envelope env = originalRaster.getRasterReference().getEnvelope( newTileRect, null ); SimpleRaster procesRaster = originalRaster.getSubRaster( env ).getAsSimpleRaster(); DEMFilter filter = new SmoothingFilter( size, stdevCorr, procesRaster ); SimpleRaster filteredResult = filter.applyFilter(); resultWriter.push( filteredResult ); this.availableFilters.push( this ); synchronized ( lock ) { lock.notifyAll(); } LOG.info( "{}. Filtering of tile took: {} seconds.", Thread.currentThread().getName(), ( Math.round( ( currentTimeMillis() - time ) / 10d ) / 100d ) ); } }
public static Envelope getEnvelope( IIOMetadata metaData, int width, int height, ICRS crs ) { GeoTiffIIOMetadataAdapter geoTIFFMetaData = new GeoTiffIIOMetadataAdapter( metaData ); try { double[] tiePoints = geoTIFFMetaData.getModelTiePoints(); double[] scale = geoTIFFMetaData.getModelPixelScales(); if ( tiePoints != null && scale != null ) { RasterGeoReference rasterReference; if ( Math.abs( scale[0] - 0.5 ) < 0.001 ) { // when first pixel tie point is 0.5 -> center type // rb: this might not always be right, see examples at // http://www.remotesensing.org/geotiff/spec/geotiff3.html#3.2.1. // search for PixelIsArea/PixelIsPoint to determine center/outer rasterReference = new RasterGeoReference( CENTER, scale[0], -scale[1], tiePoints[3], tiePoints[4], crs ); } else { rasterReference = new RasterGeoReference( OUTER, scale[0], -scale[1], tiePoints[3], tiePoints[4], crs ); } return rasterReference.getEnvelope( OUTER, width, height, crs ); } } catch ( UnsupportedOperationException ex ) { LOG.debug( "couldn't read crs information in GeoTIFF" ); } return null; }
new RasterRect( 0, 0, outWidth, outHeight ), null ); Envelope envelope = currentRaster.getRasterReference().getEnvelope( new RasterRect( size2, size2, outWidth, outHeight ), null );
this.setTileHeight( rasterReference.getEnvelope( new RasterRect( 0, 0, tileWidth, tileHeight ), null ).getSpan1() ); String cD = options.get( RasterIOOptions.RASTER_CACHE_DIR ); File cacheDir = ( cD == null ) ? RasterCache.DEFAULT_CACHE_DIR : new File( cD );
/** * Calculates the envelope for a tile at a given position in the grid. * * @param column * column id, must be in the range [0 ... #columns - 1] * @param row * row id, must be in the range [0 ... #rows - 1] * @return the tile's envelope */ protected Envelope getTileEnvelope( int column, int row ) { int xOffset = column * infoFile.getTileRasterWidth(); int yOffset = row * infoFile.getTileRasterHeight(); RasterRect rect = new RasterRect( xOffset, yOffset, infoFile.getTileRasterWidth(), infoFile.getTileRasterHeight() ); return infoFile.getGeoReference().getEnvelope( rect, null ); // double xOffset = columnId * tileWidth; // double yOffset = ( infoFile.rows() - rowId - 1 ) * tileHeight; // // double minX = envelope.getMin().get0() + xOffset; // double minY = envelope.getMin().get1() + yOffset; // double maxX = minX + tileWidth; // double maxY = minY + tileHeight; // // return geomFac.createEnvelope( minX, minY, maxX, maxY, envelope.getCoordinateSystem() ); }
/** * @param gMif * @param width * @param height */ private CacheInfoFile( GridMetaInfoFile gMif, int width, int height, boolean[][] tilesOnFile, long modificationTime ) { super( gMif.getGeoReference(), gMif.rows(), gMif.columns(), gMif.getTileRasterWidth(), gMif.getTileRasterHeight(), gMif.getDataInfo() ); this.rWidth = width; this.rHeight = height; this.tilesOnFile = tilesOnFile; this.modificationTime = modificationTime; this.envelope = gMif.getGeoReference().getEnvelope( OriginLocation.OUTER, rWidth, rHeight, envelope.getCoordinateSystem() ); }
this.outputY = nextPowerOfTwo; Envelope env = raster.getRasterReference().getEnvelope( new RasterRect( 0, 0, outputX, outputY ), null );
@Override public void setSubRaster( double x, double y, AbstractRaster source ) { RasterGeoReference srcREnv = source.getRasterReference(); RasterGeoReference dstREnv = new RasterGeoReference( srcREnv.getOriginLocation(), srcREnv.getResolutionX(), srcREnv.getResolutionY(), x, y ); Envelope dstEnv = dstREnv.getEnvelope( source.getColumns(), source.getRows(), source.getCoordinateSystem() ); RasterData srcData = source.getAsSimpleRaster().getRasterData(); SimpleRaster movedRaster = new SimpleRaster( srcData, dstEnv, dstREnv, metadata ); setSubRaster( dstEnv, movedRaster ); }
Envelope rasterEnvelope = this.geoReference.getEnvelope( width, height, options.getCRS() ); RasterData data = RasterDataFactory.createRasterData( width, height, rdi, geoReference, buffer, true, FileUtils.getFilename( this.file ), options );
Envelope envelope = raster.getRasterReference().getEnvelope( data.second, subset.getCoordinateSystem() ); double dataMinX = envelope.getMin().get0(); double dataMinY = envelope.getMin().get1();
private AbstractRaster loadFromReader( JAIRasterDataReader reader, RasterIOOptions options ) { width = reader.getColumns(); height = reader.getRows(); setID( options ); reader.close(); OriginLocation definedRasterOrigLoc = options.getRasterOriginLocation(); // create a 1:1 mapping rasterReference = new RasterGeoReference( definedRasterOrigLoc, 1, -1, 0.5, height - 0.5 ); if ( options.hasRasterGeoReference() ) { rasterReference = options.getRasterGeoReference(); } else { if ( options.readWorldFile() ) { try { if ( file != null ) { rasterReference = WorldFileAccess.readWorldFile( file, options ); } } catch ( IOException e ) { // } } } Envelope envelope = rasterReference.getEnvelope( width, height, null ); // RasterDataContainer source = RasterDataContainerFactory.withDefaultLoadingPolicy( reader ); // RasterDataContainer source = RasterDataContainerFactory.withLoadingPolicy( reader, options.getLoadingPolicy() // ); RasterDataInfo rdi = reader.getRasterDataInfo(); return RasterFactory.createEmptyRaster( rdi, envelope, rasterReference, this, true, options ); }
Envelope envelope = rasterReference.getEnvelope( width, height, readCRS );