I am trying to round up the coordinates in my file to 3 decimal places rather than the usual length they are normally at. I have been trying the ".toFixed(n)" method but with no results.
//line css
var lineStyle = {
"color": "#ff3300",
"weight": 1,
"opacity": 0.5
};
//line display command
var lineLayer = L.geoJSON(controlLines, function(feature, coordinates) {
for (coordinates in feature) {
return (+feature.coordinates).toFixed(3);
}
},
{
style: lineStyle
}).addTo(map);
My data looks as so:
var controlLines = [
{
"geometry":{
"type":"LineString",
"coordinates":[
[
-3.231658,
51.687026
],
[
-3.231659,
51.687016
]
]
},
"type":"Feature",
"properties":{
"User_ID":1002848324
}
},
{...}]
Any advice or answers would be greatly appreciated.