More

Converting x,y on mercator to WGS84 latitude and longitude

Converting x,y on mercator to WGS84 latitude and longitude


How do I convert a particular point on a Mercator map (points in a Mercator map svg) to WGS84 coordinates? Is it simply a direct translation of the x,y values, using a multiplier which matches the map width & height to -180… 180 and -90… 90?


WGS84 is an ellipsoidal coordinate system. The math for these conversions is considerably more involved than if we used a spherical model of the Earth; that's one of the reasons why people like Google opted for Web Mercator, which plots WGS84 coordinates using a spherical model, the error caused by this being negligible for most everyday uses.

If using a spherical model of the Earth and introducing some error is okay:

Provided the map is in the usual aspect (i.e., Equator runs left-right through the vertical center of the map), the longitude is as simple as you suggest only if Greenwich, England (the Prime Meridian) is in the center of the map. The latitude is not that simple in any case.

You need to use the inverse formulas for the Mercator projection. See these on page 44 of John Snyder's book (http://pubs.usgs.gov/pp/1395/report.pdf). Your globe radius R can be determined from the length of the Equator in your image, which is the circumference of the globe, and your x,y points on the image need to be determined relative to 0 lat and 0 long, where the Prime Meridian meets the Equator.

If you need very high accuracy, take a look at the inverse formulas for the ellipsoid, again by John Snyder, page 44.