PyCRS
PyCRS copied to clipboard
Non deterministic conversion between WKT and Proj.4
I found an extremely weird behavior with pycrs.parser
where the conversion changes randomly with each Python interpreter.
This is the offending script:
import pycrs
# From https://epsg.io/2000
wkt_epsg_2000 = '''PROJCS["Anguilla 1957 / British West Indies Grid",
GEOGCS["Anguilla 1957",
DATUM["Anguilla_1957",
SPHEROID["Clarke 1880 (RGS)",6378249.145,293.465,
AUTHORITY["EPSG","7012"]],
AUTHORITY["EPSG","6600"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4600"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-62],
PARAMETER["scale_factor",0.9995],
PARAMETER["false_easting",400000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","2000"]]'''
print(pycrs.parser.from_esri_wkt(wkt_epsg_2000).to_proj4())
And this is what happens if I run it from the command line:
$ python wtf.py
+proj=utm +a=6378249.145 +f=293.465 +pm=0.0 +lat_0=0.0 +lon_0=-62.0 +x_0=400000.0 +y_0=0.0 +units=m +axis=enu +no_defs
$ python wtf.py
+proj=utm +a=6378249.145 +f=293.465 +pm=0.0 +lat_0=0.0 +lon_0=-62.0 +x_0=400000.0 +y_0=0.0 +units=m +axis=enu +no_defs
$ python wtf.py
+proj=tmerc +a=6378249.145 +f=293.465 +pm=0.0 +lat_0=0.0 +lon_0=-62.0 +x_0=400000.0 +y_0=0.0 +units=m +axis=enu +no_defs
Notice how the projection changes randomly. I cross checked with @slava-kerner in another machine and the same happens. The problem does not appear within a running Python process.
I removed "ESRI" from the issue title because the same behavior occurs with from_ogc_wkt
and from_unknown_wkt
.
That's quite strange. Did you ever figure this one out? Will try this myself too.
Sorry, I switched to pyproj for this task.