jared stallings a écrit :
> I have a specific need to reproject geoTIFF imagery between various 
> projections for display in a viewer I already have.  I have looked 
> through the site, the code, javadocs and etc.  Based on what I've seen, 
> and in the post referenced in the subject line, it appears that this may 
> be a possiblity with GeoTools, but I am having trouble finding exactly 
> what to do. GeoTools does so much more that it's hard to isolate how to 
> solve my specific need.  Do you have any code snippets of reprojecting a 
> geotiff image between different projections?  If not, is this something 
> I should be able to easily do with geotools?

The most tedious part is to create the GridCoverage2D object:

   * Look at the geotiff module, it may provides everything needed
     for creating directly a GridCoverage2D instance from a GeoTIFF
     file. Simone could tell more about this module.

   * If you wish to create the GridCoverage2D by hand, then:

     * Read the image as a RenderedImage using Java Image I/O API.

     * Create a CoordinateReferenceSystem for the image CRS. The easiest
       was it to use the CRS.decode(String) convenience method if you know
       the EPSG code for the CRS.

     * Create a GeneralEnvelope instance with the image bounding box in
       coordinates of the above-cited CRS.

     * Create the GridCoverage2D instance using one of the 
CoverageFactory.create
       methods. You can get an instance of CoverageFactory using
       org.geotools.coverage.FactoryFinder.getCoverageFactory.

   * Once you have a GridCoverage2D instance, create an other
     CoordinateReferenceSystem instance for the target CRS (the one you want to
     reproject in). Again, the easiest way is to use CRS.decode(String) if you
     know the EPSG code.

   * Invoke Operations.resample(coverage, targetCRS). The Operations class is
     defined in org.geotools.coverage.processing if my memory serve me right.

         Martin



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to