Hi,
I am calibrating a function getCountyId that receives coordinates and features as parameters, it returns levels id from Ecuador.
Here is the code
function getCountyId(features, point) {
const n = features.length
if (!!point) {
for (let i = 0; i < n; i++) {
const coordinates = features[i].geometry.coordinates[0]
if (d3.polygonContains(coordinates, point)) {
return features[i].id
}
}
return NaN
}
}
The function is working around 80% and still has problems with some provinces from Ecuador.
Here is the status of the number of coordinates that the function doesn’t identify.
Map(6) {“ESMERALDAS” => 59, “GUAYAS” => 501, “EL ORO” => 10, “MANABI” => 15, “AZUAY” => 2, “GALAPAGOS” => 1}
Any suggestion would be eternally appreciated.
Notebook is here
Missed in Ecuador