I have 2 geojson feature collections in leaflet. One of them is road and the other one is parcels. I want to calculate buffer for road and then intersect this buffer layer with parcels. How can I do this using turf.js and leaflet. I am a newby in both of them. I tried to write a little script but it does not work. Could you tell me what ı am doing wrong. Here is a little part of my code that I wrote so far:

  var buffered = turf.buffer(road, road.width, {units: 'meters'});
  var roadbuf = L.polygon(buffered, {style:myStyle}).addTo(mymap);

1 Answer 1


Try something like this.

var buffered = turf.buffer(road.toGeoJSON(), road.width, {units: 'meters'});
var roadbuf = L.polygon(buffered, {style:myStyle}).addTo(mymap);

A Leaflet layer is not quite the same thing as a Turf GeoJSON layer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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