This code is not working and I don't know why?
function getlatlong(b,d){
return b,d;
}
function buffer(feature){
var point = {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: getlatlong(feature.properties.x,feature.properties.y)
},
properties: {}
};
var unit = 'meters';
var buffered = turf.buffer(point, 10, unit);
var result = turf.featurecollection([buffered, point]);
L.geoJson(buffered).addTo(map);
1 Answer 1
It might have to do with your getlatlong() function. I would try to troubleshoot by first replacing coordinates: getlatlong(feature.properties.x, feature.properties.y)
with [1,1]
or some other simple known X and Y. If that works then your issue is with this. If not you've ruled that out.
I don't see anything misspelled or punctuation missing so after that I can't see what would stop it. An error message would help at this point.
-
thank you for your replay,I tried with coordinates (40.5454,1.6544) but always without result ??user28253– user282532016年06月15日 07:26:06 +00:00Commented Jun 15, 2016 at 7:26
-
Open the console feature for your browser and trace any errors and add them to your question. If there aren't any then add that fact to your original question and maybe someone with a better eye can see the issue.Barrett– Barrett2016年06月15日 19:04:41 +00:00Commented Jun 15, 2016 at 19:04
-
this is the correct code to display a buffer around point:user28253– user282532016年06月16日 10:31:16 +00:00Commented Jun 16, 2016 at 10:31
-
var pt = { "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [2.17279,44.04812] } }; var b = turf.buffer(pt,500,"meters"); var bufferLayer500 =L.geoJson(b).addTo(map); bufferLayer500.setStyle({color: "#FFFF00"});user28253– user282532016年06月16日 10:34:33 +00:00Commented Jun 16, 2016 at 10:34
Explore related questions
See similar questions with these tags.