[geotk] comparing CRS

Philippe Kruschitz kruschitz at grid-it.at
Thu Aug 26 07:18:19 EDT 2010


Hi,

I'm picking up this old thread because I have a problem which I can't
solve. The solutions given previously worked perfectly for me until now,
when I tried to import a specific shapefile. In my application, the user
selects shapefiles that he wants to add to the map. Before this happens,
the projection of the new shapefiles is checked to correspond to the
current project/map projection (in my case, it must be).

Here is the project projection (created using geotk):

PROJCS["MGI / Austria GK M31",
GEOGCS["MGI",
DATUM["Militar-Geographische Institut",
SPHEROID["Bessel 1841", 6377397.155, 299.1528128,
AUTHORITY["EPSG","7004"]],
TOWGS84[601.705, 84.263, 485.227, 4.7354, -1.3145, -5.393,
-0.4927047426824391],
AUTHORITY["EPSG","6312"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Geodetic latitude", NORTH],
AXIS["Geodetic longitude", EAST],
AUTHORITY["EPSG","4312"]],
PROJECTION["Transverse Mercator", AUTHORITY["EPSG","9807"]],
PARAMETER["central_meridian", 13.333333333333334],
PARAMETER["latitude_of_origin", 0.0],
PARAMETER["scale_factor", 1.0],
PARAMETER["false_easting", 450000.0],
PARAMETER["false_northing", -5000000.0],
UNIT["m", 1.0],
AXIS["Northing", NORTH],
AXIS["Easting", EAST],
AUTHORITY["EPSG","31258"]]

An here is the problematic shapefile projection (created by ArcGIS):

PROJCS["MGI / Austria GK M31",
GEOGCS["MGI",
DATUM["Militar-Geographische Institut",
SPHEROID["Bessel 1841",6377397.155,299.1528128]],
PRIMEM["Greenwich",0.0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["false_easting",450000.0],
PARAMETER["false_northing",-5000000.0],
PARAMETER["central_meridian",13.33333333333333],
PARAMETER["scale_factor",1.0],
PARAMETER["latitude_of_origin",0.0],
UNIT["m",1.0]]


So, neither CRS.equalsIgnoreMetadate(projectCRS, shapeCRS) nor
CRS.findTransform(projectCRS,shapeCRS).isIdentity() will return true.

The three main differences here (except all the AUTHORITY[] information,
which, if I understood the equalIgnoreMetadata() method correctly,
aren't considered) are:
- TOWGS84 datum transformations parameters are found in the first one,
- the degree unit is more "precise" in the first one (i.e. the second
one is rounded to the 16th decimal digit) and
- the degree unit has also one more decimal digit ('4').

I thought the problem was caused by one of these, but even after
changing the values in the second .prj file to correspond to the project
projection, the two CRS won't be recognized as "equal".

Does anyone have clue?

Thanks,

Philippe

-- 

GRID-IT Gesellschaft für angewandte Geoinformatik mbH
Technikerstrasse 21a, A-6020 Innsbruck
web www.grid-it.at
fax +43-(0)512-5074869

tel +43-(0)512-507 4864
mail kruschitz at grid-it.at


More information about the Geotoolkit mailing list