I have a map with a simple WMS layer in spherical mercator projection (rendered by a OSM-Mapnik-TileCache server stack, everything is in EPSG:900913 / EPSG:3857).

First: I can't understand why, if Leaflet uses CRS EPSG:3857, whose unit is meters, I still have to provide coordinates, like maxBounds and center, in WGS84 format, which is degrees. Is it an API inconsistency?

Second: I need to render a GeoJSON feature expressed in WGS84 coordinates (EPSG:4326), but the shape is visibly distorted (see pics below). Should I convert the shape from EPSG:4326 to EPSG:3857? How? If I did so, I would have coordinates expressed in meters, while Leaflet still expects degrees!

I made a double check with a simple wms layer in OpenLayers and a GeoJSON overlay and it works fine, so I proved that the distortion is not in the data.

Any clue?

Here is the test GeoJSON, hope someone can understand the reason of the issue:

    "type": "Polygon",
    "coordinates": [
            [14.740017498458682, 40.673078870109705],
            [14.740132563378529, 40.673283531348574],
            [14.741625561383819, 40.67246759585111],
            [14.741671820229074, 40.672308542443076],
            [14.74151049646397, 40.672262934612235],
            [14.740017498458682, 40.673078870109705]

GeoJSON feature on Leaflet map: snap 2014-03-13 at 18 19 02

GeoJSON feature on OpenLayers map: snap 2014-03-13 at 18 18 48

closed as unclear what you're asking by Devdatta Tengshe, Jason Scheirer, PolyGeo, Fezter, Simbamangu Mar 24 '14 at 7:29

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Does open layer expect the coordinates as LatLong instead of X Coordinate (i.e. Longitude) and Y coordinate (i.e. Latitude)? – LarsVegas Mar 21 '14 at 15:01
  • There are multiple sub questions, and you'll get quicker help if you keep only one question per post. To Answer your main question, we'll need to know how your data should actually look. Can you post an image of that? – Devdatta Tengshe Mar 24 '14 at 5:07
  • Thanks guys, it seems I actually solved the issue. The problem seems to be not in how Leaflet handles projections, but in my GeoJSON data. I managed to perform calculations in a CRS that best suits my needs (EPSG:3004), then projecting to EPSG:4326, and the shape now looks good. – a.martelli Mar 24 '14 at 9:39