I am reading a PNG image with world file in NZMG (EPSG:27200), reprojecting
to NZTM (EPSG:2193) and saving the resulting reprojection to file using
WorldImageWriter.
When I view the images in Udig, the reprojected image is rotated 90
counterclockwise from the original image.
I can see there is a problem from the .pnw file

1.9992326319956684
0.0
0.0
-1.9993387541250558
5178586.918711518
1570650.3363139206

The x and y coordinates of the corner are switched.

What I am i doing wrong in reprojecting this data?

The code doing the reprojection is:

try
{
File rasterFile = new File("TestData/heathcote_max_vel.png");
      WorldImageFormat format = (WorldImageFormat)
GridFormatFinder.findFormat( rasterFile );
                        AbstractGridCoverage2DReader reader = 
format.getReader(rasterFile);
                        //WorldImageReader reader = new 
WorldImageReader(rasterFile, null);
                        GridCoverage2D myGridCov = reader.read(null);
                        GridCoverage2D reprojected = (GridCoverage2D)
Operations.DEFAULT.resample(myGridCov, CRS.decode("EPSG:2193"));
                        WorldImageWriter wiw = new WorldImageWriter(new
File("TestData/heathcoteTONZMG.png"));
                        ParameterValueGroup params = 
reader.getFormat().getWriteParameters();
                
params.parameter(WorldImageFormat.FORMAT.getName().toString()).setValue("png");
                        GeneralParameterValue[] gpv = {
params.parameter(WorldImageFormat.FORMAT.getName().toString()) };
                        wiw.write(reprojected, gpv);
                        wiw.dispose();
} catch (Exception e) {
}


Gaby



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Reprojection-error-tp5068565.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to