I am trying to use turfjs with leaflet for splitting a polygon by a number of linestrings(using my own algorithm that uses turf.lineIntersect()). It works most of the time ok. but sometimes produces undesired results. Could be something wrong with my logic. I was told that leaflet's default projection system is different from turf's default projection system. Is it true? I could not find any proof. Do we have to consider projections when using turf with leaflet?


Turf.js library deals with GeoJSON vector data, so it uses unprojected WGS84 coordinate system, which is EPSG:6326. Since library is used only for calculations and not for data display, that's enough.

On the other side, Leaflet is used for displaying geodetic data, which can be of two types: vector or raster. For operations/calculations with vector data Leaflet uses unprojected EPSG:4326, which is EPSG:6326 with swapped coordinates. That's why all the input coordinates to Leaflet functions are in this CRS. But before this data can be displayed, it has to be projected to flat surface. Leaflet uses WGS 84 Spherical Mercator CRS for that, known also as EPSG 3857.

When dealing with raster data (tiles), Leaflet expects them to be in projected EPSG 3857 coordinates.

So to answer your question, Leaflet and Turf.js use the same CRS datum for dealing with GeoJSON vector data.

If you get unexpected results when cutting polygons with lines, it is result of your algorithm not working correctly.

Remark: Edited to incorporate correction and clarification from nmtoken.

  • The coordinate reference system for all GeoJSON coordinates is a geographic coordinate reference system, using the World Geodetic System 1984 (WGS 84) datum, with longitude and latitude units of decimal degrees. This is equivalent to the coordinate reference system identified by the Open Geospatial Consortium (OGC) URN urn:ogc:def:crs:OGC::CRS84. World Geodetic System 1984 datum is EPSG::6326. EPSG::4326 uses EPSG::6326 but has axes of Lat/long... GeoJSON is not EPSG:4362. – nmtoken Nov 16 at 16:24
  • @nmtoken Thanks! I'm just GIS beginner learning. I know that GeoJSON has swapped coordinates, I just forgot that this means it's not EPSG:4326. – TomazicM Nov 16 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.