Gaby,

your sourceCRS has axis order Northing/Easting, but your envelope bounds 
look like Easting/Northing.

It appears that EPSG:2193 is registered in the EPSG database with axis 
order Nothing/Easting:
http://www.epsg-registry.org/
http://www.epsg-registry.org/export.htm?gml=urn:ogc:def:crs:EPSG::2193
http://www.epsg-registry.org/export.htm?gml=urn:ogc:def:cs:EPSG::4500

This is the opposite to that on spatialreference.org (pretty but not 
canonical):
http://spatialreference.org/ref/epsg/2193/
http://spatialreference.org/ref/epsg/2193/prettywkt/

GeoTools gt-epsg-hsql is populated from the EPSG database, and will 
honour the axis order specified. Confirmed with the following (which 
ignore ugly properties and hints for changing axis order):
System.out.println(CRS.decode("urn:ogc:def:crs:EPSG:2193"));
System.out.println(CRS.decode("http://www.opengis.net/def/crs/EPSG/0/2193";));

I was quite surprised to see Northing/Easting axis order. I do not have 
the domain expertise to know whether this is a bug.

Kind regards,
Ben.

On 29/07/13 11:06, gaby wrote:
> 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-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

-- 
Ben Caradoc-Davies <ben.caradoc-dav...@csiro.au>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
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-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to