I'm using OL v4.3.2 and turfjs. I want to use turf buffer function to create buffer arround a clicked feature based on a radius, but the result is not accurate and the buffer is very smaller than it should be. so anybody can help me? I would be really appreciated.
map.on('singleclick', function (e) {
var coord = e.coordinate;
var pixel = e.pixel;
console.log(coord);
map.forEachFeatureAtPixel(pixel, function (feature, layer) {
console.log(feature);
var p= feature.getGeometry().getCoordinates();
var input_turf = turf.point(p);
var buffered = turf.buffer(input_turf, 30, 'kilometers');
var source = new ol.source.Vector();
var format = new ol.format.GeoJSON();
var features = format.readFeatures(buffered);
source.addFeatures(features);
var bufferd_layer = new ol.layer.Vector({
source: source
});
map.addLayer(bufferd_layer);
},{
hitTolerance: 15
})
});