Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using LeafletJS. I want to create buffer around point. after Selecting a point buffer radius will be specifed by user in feet. After searching of awhile I found this link of JSTS. does JSTS buffer works with leafletJS ?? I am not able to find any sample for this.

Any Other solution to archive same will be appreciated.

Update 1

After look into the code of JSTS and searching for a while, I came to a conclusion, there is no conversion between JSTS geometry and Leaflet JS geometry. so it is not possible to use it without implementing conversion.

share|improve this question

3 Answers 3

Just to add for future reference, I got JSTS to work with Leaflet.js by exporting / importing GeoJSON between the two libraries.

It's obviously not very efficient if you're doing a lot of processing but for simple one off conversions it's a pretty straightforward solution.

function buffer(leafletGeometry, distance){
    var reader = new jsts.io.GeoJSONReader();
    var input = reader.read(leafletGeometry.toGeoJSON());
    input = input.geometry.buffer(distance);

    var bufferGeoJSON = new jsts.io.GeoJSONWriter().write(input);
    return L.geoJson(bufferGeoJSON);
share|improve this answer

Can't you use LeafletJS circle? Do you plan on doing some spatial queries with that buffer?

share|improve this answer
Yes, I want to later user it in spatial query. –  anand Apr 5 '13 at 11:34
How do you perform the spatial query ? With PostGIS ? –  FredB Apr 5 '13 at 12:19

You can do this using turf. Here is some code for an example:

var turf = require('turf') // this line is for node.js, but you do not need it in the browser
var pt = turf.point(0, 0.5)
var unit = 'miles'

// 10 mile ring
var buffered = turf.buffer(pt, 10, unit)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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