1

We are using a custom CRS for our map in order to use the British National Grid (EPSG:27700), however we have realised now that turf.buffer will not work with it, and appears to only work with Lat/Long (EPSG:4326). What is the best way to buffer shapes when using a custom CRS?

In L.map we are setting crs : L.CRS.BNG where L.CRS.BNG is L.extend({}, L.CRS.Simple, { options...})

When using lat/long, for buffering we do: turf.buffer(geoJson, bufferValue, {units: 'metres'})

5
  • There should be o problem with this, since standard GeoJSON has coordinates in EPSG:4326 anyway, and Leaflet expects it to be so. Leaflet takes care that GeoJSON vector layer coordinates are converted to map CRS, whatever this CRS is.
    – TomazicM
    Oct 12 at 17:40
  • 2
    @TomazicM GeoJSON is not EPSG:4326 (lat/long) it's CRS:84 (long/lat)
    – nmtoken
    Oct 12 at 18:45
  • @nmtoken Ups, I again forgot that. Thanks! But the main thing remains: turf.js uses lng/lat order, as does the GeoJSON, and Leaflet can handle that. But it's also true that Leaflet uses lat/lng order as coordinate input format to it's methods. Only GeoJSON layer source is expected to have coordinates in standard GeoJSON lng/lat order.
    – TomazicM
    Oct 12 at 18:59
  • @TomazicM when using the custom CRS I have the geojson using the coordinates in EPSG:27700, not the standard long/lat. I'm asking how to buffer in this situation.
    – fred
    Oct 13 at 11:02
  • Then please edit your question and post more of relevant code (map and layer creation etc.).
    – TomazicM
    Oct 13 at 14:04

Your Answer

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

Browse other questions tagged or ask your own question.