Dear all,
I have a problem with inconsistent result between two independent
program requiring projection from WGS84 (EPSG:4326) to EPSG:3035 (ETRS89
/ ETRS-LAEA)
I have been developing a project using maven to access the 2.4-SNAPSHOT
version of geotools. I have been happy with the result until I exported
by data and visualized them against some legacy datasets in the
EPSG:3035 projection. Mine were shifted away, and I localised the error
as switched order of x and y coordinates. I am projecting from WGS84 and
I suspected the order of lon/lat could be the problem. While
http://docs.codehaus.org/display/GEOTDOC/The+axis+order+issue claims
that the standard order for EPSG:4326 is lat,lon and suggests to use the
explicit switch of the coordinates to work with lon/lat, this was not
the problem, as it seems that the database holds these coordinates as
lon/lat!!! (not according to the EPSG standard):
see
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
System.out.println("Source: "+sourceCRS);
Source: GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Longitude", EAST],
AXIS["Latitude", NORTH],
AUTHORITY["EPSG","4326"]]
Anyway, I changed the order of lon and lat in my input data and tried
the conversion to EPSG:3035. The output values were accurate, but in the
wrong order - northing, then easting.
Target: PROJCS["ETRS89 / ETRS-LAEA",
GEOGCS["ETRS89",
DATUM["European Terrestrial Reference System 1989",
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","6258"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Geodetic latitude", NORTH],
AXIS["Geodetic longitude", EAST],
AUTHORITY["EPSG","4258"]],
PROJECTION["Lambert Azimuthal Equal Area", AUTHORITY["EPSG","9820"]],
PARAMETER["latitude_of_center", 52.0],
PARAMETER["longitude_of_center", 10.0],
PARAMETER["false_easting", 4321000.0],
PARAMETER["false_northing", 3210000.0],
UNIT["m", 1.0],
AXIS["Northing", NORTH],
AXIS["Easting", EAST],
AUTHORITY["EPSG","3035"]]
I tried to isolate the behavior and also tried the same in an old code I
had, not using maven (just a local copy of gt2-2.4.0). There, the output
was correct in EPSG:3035, with ordinate order easting, northing.See the
difference in the WKT output!
Target: PROJCS["ETRS89 / ETRS-LAEA",
GEOGCS["ETRS89",
DATUM["European_Terrestrial_Reference_System_1989",
SPHEROID["GRS 1980", 6378137.0, 298.257222101,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6258"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Longitude", EAST],
AXIS["Latitude", NORTH],
AUTHORITY["EPSG","4258"]],
PROJECTION["Lambert_Azimuthal_Equal_Area"],
PARAMETER["latitude_of_center", 52.0],
PARAMETER["longitude_of_center", 10.0],
PARAMETER["false_easting", 4321000.0],
PARAMETER["false_northing", 3210000.0],
UNIT["m", 1.0],
AXIS["x", EAST],
AXIS["y", NORTH],
AUTHORITY["EPSG","3035"]]
The transforms are identical.
The code I use is:
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");//WGS84
EPSG code
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:3035"); //
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS,true);
Geometry newgeom = JTS.transform( geom, transform);
I checked,
System.out.println(System.getProperty("org.geotools.referencing.forceXY"));
returns false, so there are no global effects that I could not trace.
Does anyone have any idea why this may be? Also, what is the proper
handling of the axis order in EPSG:4326, that adheres to the EPSG standard?
Thanks
Martin
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users