Hi,

I want render a tiff file.
It works perfectly with geotiff files.

But when Iget the coordinates and resolution from an .tfw, I have to set the Coordinatereferencesystem.

How do I set the CRS manually?

I tried the following, but the GridCoverage does not inherit the CRS from CRSEnvelope.

   public static void main(String[] args) throws Exception {
       String name = args[0];
       Style style = JMapStyles.getRasterStyle(1.0);
       GridCoverageFactory gcFactory = new GridCoverageFactory();
       double dist =1000.0;
       double x=3544563.0;
       double y = 5789834.0;
       CRSEnvelope envelope =
           new CRSEnvelope("31467", x,y,x+dist,y+dist);

GridCoverage2D gridCoverage = gcFactory.create(name, getImage(name), envelope); Object o = gridCoverage.getCoordinateReferenceSystem();
       if ( o.equals (CRS.decode("EPSG:31467")){
           System.out.println("That wolud be nice, but I never get here");
       }
       System.out.out(o);
   }
The output:

GEOGCS["WGS84",
 DATUM["WGS84",
   SPHEROID["WGS84", 6378137.0, 298.257223563]],
 PRIMEM["Greenwich", 0.0],
 UNIT["degree", 0.017453292519943295],
 AXIS["Geodetic longitude", EAST],
 AXIS["Geodetic latitude", NORTH]]

I am using geotools 2.4.3.

Thanks for your help.

Rainer

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to