I am new to JS, I am working on a map application, I have to filter a geoJson file, using the filter or find function, the value of the coordinates is rounded, Im getting -8248331.906734363 instead of -8248331.906734363175929
Is there some way to get the correct value?
const Floor1 = {
points:{
"type": "FeatureCollection",
"name": "PointsP2",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature",
"properties": { "id": null, "type": "point", "name": "rehab" },
"geometry": { "type": "Point", "coordinates": [ -8248331.906734363175929, 518109.842791541363113 ] } },
{ "type": "Feature",
"properties": { "id": null, "type": "point", "name": "fisio" },
"geometry": { "type": "Point", "coordinates": [ -8248323.718446247279644, 518115.804757916892413 ] }
}]
}
}
const findRoomByName = name => {
let found = Floor1.points.features.filter( //find
feature => feature.properties.name.indexOf(name) > -1);
return found ;
}
console.log(findRoomByName("fisio"))
the result if i search 'rehab
' is:
...
properties: Object
geometry: Object
type: "Point"
coordinates: Array(2)
0: -8248331.906734363
1: 518109.84279154136
...