Gaby,

Your questions are thought provoking and likely useful to others.

If you could direct your replies to the list rather than the responding user it 
would be most helpful.

Brett

-----Original Message-----
From: gaby [mailto:g.tu...@niwa.co.nz] 
Sent: Monday, 29 July 2013 1:06 PM
To: geotools-gt2-us...@lists.sourceforge.net
Subject: [Geotools-gt2-users] Need help reprojecting ReferencedEnvelope

I would like to reproject a ReferencedEnvelope from NZMG to NZTM.

My code is a follows:
ReferencedEnvelope envelope = new ReferencedEnvelope(xmin, xmax, miny, maxy, 
sourceCRS);

In Eclipse I can see it contains the correct bounds and CRS:

ReferencedEnvelope[1567451.39 : 1570650.34, 5178586.92 : 5184734.56]
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
  GEOGCS["NZGD2000", 
    DATUM["New Zealand Geodetic Datum 2000", 
      SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], 
      TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 
      AUTHORITY["EPSG","6167"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic latitude", NORTH], 
    AXIS["Geodetic longitude", EAST], 
    AUTHORITY["EPSG","4167"]],
  PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]],
  PARAMETER["central_meridian", 173.0],
  PARAMETER["latitude_of_origin", 0.0],
  PARAMETER["scale_factor", 0.9996],
  PARAMETER["false_easting", 1600000.0],
  PARAMETER["false_northing", 10000000.0],
  UNIT["m", 1.0],
  AXIS["Northing", NORTH],
  AXIS["Easting", EAST],
  AUTHORITY["EPSG","2193"]]

To transform I use
ReferencedEnvelope newEnv = envelope.transform(targetCRS, false)

In Eclipse I can see it contains incorrect bounds and right CRS:

ReferencedEnvelope[-9.355285704178331E8 : -5.476698694654962E7,
7.380212019166924E7 : 2.0383109009204366E9]
PROJCS["NZGD49 / New Zealand Map Grid",
  GEOGCS["NZGD49", 
    DATUM["New Zealand Geodetic Datum 1949", 
      SPHEROID["International 1924", 6378388.0, 297.0, 
AUTHORITY["EPSG","7022"]], 
      TOWGS84[59.47, -5.04, 187.44, 0.47, 0.1, -1.024, -4.5993], 
      AUTHORITY["EPSG","6272"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic latitude", NORTH], 
    AXIS["Geodetic longitude", EAST], 
    AUTHORITY["EPSG","4272"]],
  PROJECTION["New_Zealand_Map_Grid", AUTHORITY["EPSG","9811"]],
  PARAMETER["latitude_of_origin", -41.0],
  PARAMETER["central_meridian", 173.0],
  PARAMETER["false_easting", 2510000.0],
  PARAMETER["false_northing", 6023150.0],
  UNIT["m", 1.0],
  AXIS["Easting", EAST],
  AXIS["Northing", NORTH],
  AUTHORITY["EPSG","27200"]]

What am I doing wrong?
Thanx
Gaby





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Need-help-reprojecting-ReferencedEnvelope-tp5069254.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
geotools-gt2-us...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
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-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to