1

I want to convert a longitude latitude point in WGS84 coordinate system to Google Maps(not google earth) coordinate, But when I put the converted point on google map, it always has a roughly 10km offset(moved to south) on y axis.

First correct me if my understanding is wrong with the two projections:

Google Maps:
    spheroid parameters: a = b = 6378137
    projection: Mercator;
    To WGS84 Datum offset: no, (means 0,0,0) 

WGS84:
    spheroid parameters: a = 6378137;b=6356752.314
    projection: WGS84;(like no projection, the coordinate is just longitude and latitude)

What I did:

Convert the WGS84 longitude, latitude(we call it point1) to geocentric coordinate(point2) with WGS84's spheroid;
//because no datum offset between Google Maps and WGS84, no need to convert point2 to Google Maps' geocentric 
Convert point2 to geodentic coordinate(point3) with Google map's spheroid
Project point3 with Mercator projection into meter coordinate(point4).
Linearly transform point4 onto google maps.

On internet everybody is saying that Google Maps' projection is 'EPSG:3857' which means a and b are the same 6378137, but if I just use standard WGS84's spheroid parameters, which means a and b are different, the whole process is always correct, the result is very accurate.

  • 1
    Why are you projecting the point youself? Why not use the functions inbuilt in the GoogleMaps API? – Devdatta Tengshe Jul 14 '14 at 3:28
  • I developed a GIS system by myself. The system is a desktop application, I put google map as the background of a vector map, letting user to edit their map with google map as reference. I have to deal with the projection in my application. – Gisway Jul 14 '14 at 6:54
  • Not relevant the original question, but you're probably getting close to breaking the ToS for Google Maps with this approach (see 10.1.3 Restrictions against Data Export or Copying, where derivative work is probably close to what you're doing - this is why OSM doesn't support gmaps as a source) – BradHards Jul 14 '14 at 7:57
  • You have to either use a = b = 6378137.0 m with a standard ellipsoid-supporting Mercator implementation OR use a Mercator implementation that supports spheres only. The error is when you converted to XYZ using WGS84, then back to lat/lon using the sphere. That changed the latitude values which is not needed to match Google's data. – mkennedy Jul 14 '14 at 17:52
  • It is easy for me to match the data. I just want to understand what is really wrong. – Gisway Jul 14 '14 at 18:03
1

The error is not on your side, but on Google's side. See

http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/

http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf

They claim to use a sphere (a=b), but really use the WGS84 ellipsoid (a>b) lat/lon coordinates.

This can not be modelled with standard projection methods, so GDAL uses a kind of hack in EPSG:3857 to get the right mercator coordinates.

  • So, Google Maps's projection is not Epsg:3857, right? Or Epsg:3857 is not Sphere? I doubted that when I was search on internet, you confirmed my thoughts. Great thanks! – Gisway Jul 15 '14 at 2:55
  • The second one. – AndreJ Jul 15 '14 at 3:54
0

The coordinate systems you mentioned, WGS 1984 and WGS84 Web Mercator (Auxiliary Sphere) (EPSG:3857), use the same spheroid and datum with parameters you written for WGS84. The semiminor and semimajor axis are not the same. Maybe that is the source of the error. See the description of the EPSG:3857 spatial reference.

  • But everywhere people say, including google maps' official website,'EPSG:3857' uses sphere, WGS 1984 use ellipsiod. They use different spheroid. This confused me a lot. – Gisway Jul 14 '14 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.