[GIS] What SRS does leaflet use when it creates new markers

coordinate systemesri-leafletleaflet

I'm using leaflet 0.7. I'm wondering what spatial reference system is used when a new marker is created? Also, how does this impact my use of maps? (I'm using leaflet .7 because of dependency requirements from other plugins). I'm using ESRI base map tiles from the esri-leaflet plugin, which I think are EPSG:3857. I have data in a postgis database in EPSG:4269. When I use the latlong from a new marker in leaflet, I get errors when trying to use that to compare it to spatial data in my database – IE find nearest geometries. I keep reading on the internet that leaflet uses 3857. However, when I transform the point from 3857 to 4269, my spatial queries don't work. However, when I do something like this, and assume the point is in 4326 in leaflet and then transform to 4269, it works – ST_Transform(ST_SetSRID(ST_MakePoint(-96.78427, 32.78299),4326),4269)).

So –

  1. Is this the case that a new marker in leaflet has coordinates stored in EPSG:4326?

  2. If I add a map tile layer like ESRI that is EPSG:3857, or some other coordinate system, even though I transform the coordinate clicks from the markers for use in the DB, does this mean that the points don't quite line up as they should on the map?

Best Answer

In applications that display EPSG:3857 basemap tiles, latlngs supplied to L.markers are reprojected, but not transformed. Another way of saying this is that Leaflet assumes that lat/long coordinates share the same WGS84 (EPSG:4326) datum as the basemap tiles.

The good news is that Esri's hosted tile services (which use the tiling scheme popularized by Google) won't allow you to zoom the map in close enough for the error introduced by failing to transform your NAD83 coordinates to be noticeable.

Related Question