orbisgis / cts

Projection library in Java
GNU Lesser General Public License v3.0
50 stars 16 forks source link

Parameter definition #77

Closed mukoki closed 7 years ago

mukoki commented 7 years ago

I found several problems in how projections are defined, read and written in esri registry (and probably also in epsg). 1 - I don't how where the esri projection file comes from, but if we take a projection like 102676 (NAD 1983 StatePlane Iowa South FIPS 1402 Feet), it has a to_meter=0.3048006096012192, but a x_0=500000.0000000002 (which is in meters according to http://www.expertgps.com/spcs/Iowa-South-FIPS-1402-NAD83.asp). According to ESRI specification (http://support.esri.com/technical-article/000001897), parameter units should be constistant with projection unit. It seems to be the same with OGC specification.

2 - In CRSHelper, x_0 parameter is read as if it was always meter, which is consistent with the current esri file (see above), but not with the specification. It may break interoperability (see how 102676 is defined in http://spatialreference.org/ref/esri/102676/html/).

3 - reading a projection in the proj file and writing it back to wkt does not preserve parameters because WKT writer is rounding all parameters to a precision of 10-11 (org.cts.op.projection.Projection). It should not change a value like 40.66666666666667 to 40.66666666667.

mukoki commented 7 years ago

Just checked in proj4 repository,

mukoki commented 7 years ago

OK, got it

proj4 specifies for the internal format : "False Easting/Northing? Virtually all coordinate systems allow for the presence of a false easting (+x_0) and northing (+y_0). Note that these values are always expressed in meters even if the coordinate system is some other units. Some coordinate systems (such as UTM) have implicit false easting and northing values.

ESRI documentation on the other side "Projection parameters use the units of measure from both the projected and geographic coordinate systems. Linear parameters, like false easting and false northing, have the same units as the linear unit of measure listed at the end of the projected coordinate system string."

OGC " is an optional attribute for reasons of backward compatibility. It is recommended that it is included explicitly in WKT strings. If omitted then:

Requirements: If is omitted from the s a CRS WKT string then: a) map projection parameter values that are lengths shall be given in the unit for the projected CRS axes."

So it seems the only problem is in the WKT writer which writes the projection parameter in meters ignoring that the CS unit is feet. Instead, it should embed in the specific unit (either meter or feet) in the parameter tag when the parameter unit is not the same as the CS unit.

mukoki commented 7 years ago

Here is an prj defining WaukeeStreets.txt

a projection in feet

ebocher commented 7 years ago

Thanks I will look on it asap

mukoki commented 7 years ago

I'll split this issue into 3 parts

ebocher commented 7 years ago

We can closed this issue and try to fix the other ones as @mukoki describes.