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

Web Mercator #834

Closed
kbevers opened this issue Mar 5, 2018 · 1 comment
Closed

Web Mercator #834

kbevers opened this issue Mar 5, 2018 · 1 comment

Comments

@kbevers
Copy link
Member

kbevers commented Mar 5, 2018

Reported by @jmckenna - se details below.

Transformations to and from the Google's pseudo/web Mercator returns incorrect results.
The problem was introduced in #743 which fixed #22 but unfortunately also broke the web Mercator. This happens since the web Mercator handles ellipsoids incorrectly (calculating coordinates on the ellipsoid, but projecting them on a sphere).

So, on hand one cs2cs/pj_transform can behave geodetically correct OR on the other hand it can behave in a slightly wrong manner but return the expected coordinates when the web Mercator is used. We want the latter option to make sure that PROJ behaves similarly to previous version.

Until a new version is release the a work around for the problem is to remove +nadgrids=@null from the web Mercator proj-string. This might be necessary to do in the epsg file, where the system is known as:

<3857> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs <>

Change it to

<3857> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +wktext +no_defs <>

and it should work again.

I wanted to test PROJ v5 by using a point 
(487147.594520173,4934316.46263998) in EPSG:26915 (UTM Zone 15) and 
reprojecting that to EPSG:3857 (Google's Mercator).

with PROJ 4.9.3
---------------

cs2cs -v +proj=utm +zone=15 +datum=NAD83 +to +proj=merc +a=6378137 
+b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m 
+nadgrids=@null
# ---- From Coordinate System ----
#Universal Transverse Mercator (UTM)
#       Cyl, Sph
#       zone= south
# +proj=utm +zone=15 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0
# ---- To Coordinate System ----
#Mercator
#       Cyl, Sph&Ell
#       lat_ts=
# +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 
+y_0=0 +k=1.0
# +units=m +nadgrids=@null
487147.594520173 4934316.46263998

RESULT POINT: -10370728.80    5552839.74 -0.00

with PROJ 5.0.0-RC6
-------------------

 >cs2cs -v +proj=utm +zone=15 +datum=NAD83 +to +proj=merc +a=6378137 
+b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m 
+nadgrids=@null
# ---- From Coordinate System ----
#Universal Transverse Mercator (UTM)
#       Cyl, Sph
#       zone= south
# +proj=utm +zone=15 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0
# ---- To Coordinate System ----
#Mercator
#       Cyl, Sph&Ell
#       lat_ts=
# +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 
+y_0=0 +k=1.0
# +units=m +nadgrids=@null
487147.594520173 4934316.46263998

RESULT POINT: -10370728.80    5522830.15 -10484.03

More here: http://lists.maptools.org/pipermail/proj/2018-February/008082.html

@kbevers
Copy link
Member Author

kbevers commented Mar 5, 2018

fixed with #830

@kbevers kbevers closed this as completed Mar 5, 2018
cffk added a commit to cffk/proj.4 that referenced this issue Mar 17, 2018
Set flags for Intel compiler to prevent incorrect optimization of
arithmetic expressions OSGeo#826.  Guard against nans in sincosdx OSGeo#834.
Issue OSGeo#831 is not addressed here (need more information...).
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

1 participant