@Override public RasterGeoReference getGeoReference() { return infoFile.getGeoReference(); }
/** * Write the grid info file which is basically a world file with supplement information. * * @param writer * to write to. * @param metaInfo * to write. * @param options * containing information about the crs, origin location etc. * @throws NumberFormatException * @throws IOException */ public static void write( PrintWriter writer, GridMetaInfoFile metaInfo, RasterIOOptions options ) throws IOException { if ( writer == null ) { throw new IOException( "The writer is null." ); } // begins with standard world file entries WorldFileAccess.writeWorldFile( metaInfo.getGeoReference(), writer ); // now infos on grid writer.println( metaInfo.rows ); writer.println( metaInfo.columns ); writer.println( metaInfo.tileRasterWidth ); writer.println( metaInfo.tileRasterHeight ); writer.println( metaInfo.dataInfo.bands ); writer.println( DataType.toDataBufferType( metaInfo.dataInfo.dataType ) ); }
/** * @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() ); }
/** * 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() ); }
/** * Creates a new {@link GriddedTileContainer} instances. * * @param infoFile * containing the relevant information. * */ protected GriddedTileContainer( GridMetaInfoFile infoFile ) { this.rdi = infoFile.getDataInfo(); this.envelope = infoFile.getEnvelope( OriginLocation.OUTER ); this.envelopeWidth = envelope.getMax().get0() - envelope.getMin().get0(); this.envelopeHeight = envelope.getMax().get1() - envelope.getMin().get1(); // this.envelopeWidth = envelope.getSpan0(); // this.envelopeHeight = envelope.getSpan1(); this.rows = infoFile.rows(); this.columns = infoFile.columns(); this.tileSamplesX = infoFile.getTileRasterWidth(); this.tileSamplesY = infoFile.getTileRasterHeight(); this.tileWidth = envelopeWidth / columns; this.tileHeight = envelopeHeight / rows; this.rasterReference = infoFile.getGeoReference(); LOG.debug( "envelope: " + envelope ); LOG.debug( "raster reference: " + rasterReference ); SampleResolution sr = new SampleResolution( new double[] { rasterReference.getResolutionX(), rasterReference.getResolutionY() } ); this.resolutionInfo = new ResolutionInfo( sr ); }