Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect transformation results when using EPSG 2263 (NY State Plane, feet US) #67

Closed
ddohler opened this issue Apr 5, 2016 · 4 comments

Comments

@ddohler
Copy link

ddohler commented Apr 5, 2016

With PyProj:

import pyproj
wgs84 = pyproj.Proj("+init=EPSG:4326")
ny_state = pyproj.Proj("+init=EPSG:2263")
pyproj.transform(wgs84, ny_state, -74.01720548026697, 40.641305906460005)

Result: (298544.59235271334, 52706.69470216743)

Compare to gdaltransform:

$ gdaltransform -s_srs EPSG:4326 -t_srs EPSG:2263
-74.01720548026697, 40.641305906460005
979475.050077194 172921.880868694 0

By contrast, PyProj and GDAL agree when transforming to WebMercator:

webmerc = pyproj.Proj("+init=EPSG:3857")
pyproj.transform(wgs84, webmerc, -74.01720548026697, 40.641305906460005)

Result: (-8239557.624004417, 4959577.466271832)

gdaltransform -s_srs EPSG:4326 -t_srs EPSG:3857
-74.01720548026697, 40.641305906460005
-8239557.62400442 4959577.46627184 0
@micahcochran
Copy link
Collaborator

EPSG:2263 is a state plane coordinate system "NAD83 / New York Long Island (ftUS)". I assume it is US Survey Feet.

You need to set the preserve_units flag to True. Otherwise, pyproj will set your coordinate units to meters.

IPython console to show my work.

In [1]: import pyproj

In [2]: ny_state = pyproj.Proj(init="EPSG:2263", preserve_units=True)

In [3]: ny_state(-74.01720548026697, 40.641305906460005)
Out[3]: (979475.050077198, 172921.88086868977)

Calling ny_state() as a function does a transform to epsg:4326, as a shortcut. Your above code should also work when you add the preserve_units=True flag.

This is not an isolated incident, other get tripped up by this too. (Duplicate of #58 , #40)

@JamesFysh
Copy link

This is not an isolated incident, other get tripped up by this too.

I just came here to raise an issue also (transforming from epsg:4326 -> epsg:102697 AKA NAD_1983_StatePlane_Missouri_Central_FIPS_2402_Feet) where I was finding that the resulting coordinates were given in meters, not us-ft as expected.

It all makes more sense now, although I wonder: What is the purpose of the preserve_units parameter? It seems like it should at least be set to True by default, as the current behavior is clearly unexpected.

@kevhill
Copy link

kevhill commented Aug 28, 2018

what's the rationale behind defaulting to preserve_units=False? This cost me probably 4 hours of time, and obviously, this is affecting multiple people. I can't see any reason why you would ever have a default that ignored specific information entered in elsewhere.

@snowman2
Copy link
Member

Closing as preserve_units=True is now the default in pyproj>=2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants