TransWikia.com

EPSG 3857 or 4326 for GoogleMaps, OpenStreetMap and Leaflet

Geographic Information Systems Asked by tymtam on July 4, 2021

The discussion at What is the difference between WGS84 and EPSG4326? shows that 4326 is just the EPSG identifier of WGS84..

Wikipedia entries for Google Maps and OpenStreetMap shows that they both use WGS 84.

http://wiki.openstreetmap.org/wiki/EPSG:3857 states that

EPSG:3857 is a Spherical Mercator projection coordinate system popularized by web services such as Google and later OpenStreetMap.

Leaflet’s help states:

EPSG3857 The most common CRS for online maps, used by almost all free and commercial tile providers. Uses Spherical Mercator projection. Set in by default in Map’s crs option.|

EPSG4326 A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.

This is confusing – it seems that Google Maps and OpenStreetMap use EPSG3857 but they use WGS84 which ‘is’ EPSG4326. Something can’t be right here, most likely my understanding.

Could someone help me understand?

4 Answers

There are a few things that you are mixing up.

  • Google Earth is in a Geographic coordinate system with the wgs84 datum. (EPSG: 4326)

  • Google Maps is in a projected coordinate system that is based on the wgs84 datum. (EPSG 3857)

  • The data in Open Street Map database is stored in a gcs with units decimal degrees & datum of wgs84. (EPSG: 4326)

  • The Open Street Map tiles and the WMS webservice, are in the projected coordinate system that is based on the wgs84 datum. (EPSG 3857)

So if you are making a web map, which uses the tiles from Google Maps or tiles from the Open Street Map webservice, they will be in Sperical Mercator (EPSG 3857 or srid: 900913) and hence your map has to have the same projection.

Edit:

I'll like to expand the point raised by mkennedy

All of this further confused by that fact that often even though the map is in Web Mercator(EPSG: 3857), the actual coordinates used are in lat-long (EPSG: 4326). This convention is used in many places, such as:

  • In Most Mapping API,s You can give the coordinates in Lat-long, and the API automatically transforms it to the appropriate Web Mercator coordinates.
  • While Making a KML, you will always give the coordinates in geographic Lat-long, even though it might be showed on top of a web Mercator map.
  • Most mobile mapping Libraries use lat-long for position, while the map is in web Mercator.

Correct answer by Devdatta Tengshe on July 4, 2021

In gist:

EPSG: 4326 uses a coordinate system on the surface of a sphere or ellipsoid of reference.

EPSG: 3857 uses a coordinate system PROJECTED from the surface of the sphere or ellipsoid to a flat surface.

Think of it as this way:

EPSG 4326 uses a coordinate system the same as a GLOBE (curved surface). EPSG 3857 uses a coordinate system the same as a MAP (flat surface).

Answered by arcsump on July 4, 2021

One way to show people what the differences in projection mean in practice is to draw a long line in Google Earth. By "long line" I mean one that is visibly a Great Circle route. Everything's fine in Google Earth. But if you draw a line between the same two points in Google Maps, CartoDB or OpenStreetMap, the line is flattened onto the flat projection. Zoom in on the middle of the line to see how far the midpoint is displaced.

Answered by Keith MacDonald on July 4, 2021

It's confusing when an API says it uses SRID 3857 but gives a location using SRID 4326

Quick way of telling what SRID your lat/lon is in: Look at how big the number & the precision

If I say Paris is:

  • A) Lat(48.8589506) Lon(2.2768485)
  • B) Lat(6250962.06) Lon(253457.62)

Given a choice of the two SRIDs above

A) is clearly in degrees, the numbers are small and there's loads of decimal places (48m from equator/2m from greenwich meridian would make Paris a tropical GMT+0 place, but my general knowledge says Paris is temperate and on CET) so SRID is 4326

B) both values are well over the max value for the unit to be degrees, it must be metres so the SRID is 3857

NB I used this site to convert 4326 to 3857 and also note this only helps if you know if it's either 3857 or 4326, there are loads of SRIDs, some measure in radians/feet etc and units aren't the only way they differ

Answered by user179876 on July 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP