[GIS] Leaflet and EPSG 4326 Projections

coordinate systemleaflettile-map-service

UPDATE: LEAFLET fixed support for EPSG 4326 (LL84) in the latest betas: https://github.com/Leaflet/Leaflet/issues/1207

Leaflet says it supports EPSG 4326 (Plate Carree, aka ll84) projections. I think it does, but take a look at these two jsfiddles:

http://jsfiddle.net/drysg/cBzVc/ – This is the original 3857 web Mercator. As you can see the overlay of both the tiles and the red outline are properly placed near Kraknow. (click the mouse on the map and you get the lat/long as a popup).

Ok, now look at:

http://jsfiddle.net/drysg/XPP54/ – This is in EPSG 4326 (ll84).

The background is a MapCarta ll84 slippy tiles. It seems that leaflet does not know about the 2×1 aspect ratio that OSG wants. That is why the background wraps (http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic) Well, if they want to support that fine. I am actually happier with with a 1×1 map (I can generate that with SAFE FME). So ignore that for a while.

Switch the background to the CloudMade OSM map (ingore that the origin is at 85N, so that the map is 5 degrees shifted to the south).

Now everything looks correct, to me.

The only thing I need now is to figure out the formula for the SLIPPY tile numbering. The web page at http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

Shows how to do this for Web Mercator. What would the formula be for LL84, where the map bounds are not (-85, -180; 85, 180) but rather (-90, -180; 90, 180)

Best Answer

I found that I could use SAFE FME to create the tiles. Since the LL84 wants a bounding box of (-90,-180;90,180) you have to add to the Y axis (row). But then it works fine. The formula is newY = 2**(zoomLevel-2) + oldY; (except for the exception for zoom levels 0 and 1).

Make sure you use the WebMapTiler with GoogleCRS84Quad (GoogleMapsCompatable would get you a spherical mercator, and we want LL84 (EPSG4326).

I am adding the screenshot for the FME project. I assume the same can be done with the gdal2tiles.py

FME SAFE screenshot