Michael Bedward ha scritto: > Hi Martin, > >> Yes, I know about gdal, but I wanted a fully automated solution within >> geotools. > > Simone is the guru for this but I'm not sure that there a GeoTools > only solution exists at the moment. > > What would be nice is if the GeoTiffReader accepted a parameter for > the envelope to read (either a GridEnvelope2D for grid coords or an > Envelope for world coords). At present you can provide a > GridGeometry2D parameter to the read method (contrary to what the > javadocs say about parameters being ignored) but unfortunately this > only seems to be used to set the resolution of the returned coverage > rather than its extent.
If the coverage is inner tiled it will limit what tiles are read, but as you say it does not do cropping. If you want to crop a coverage you should use the Operations.crop method. I can't find an example and I'm not sure I ever used it but it seems to be straightforward (though I guess it uses an "odd" variant of the Envelope class). Otherwise use the Crop class directly, there is an example of how to use it in the GridCoverageRenderer.getCroppedCoverage method: http://svn.osgeo.org/geotools/trunk/modules/library/render/src/main/java/org/geotools/renderer/lite/gridcoverage2d/GridCoverageRenderer.java Hope this helps Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
