Open rajeshthomasp opened 1 year ago
@rajeshthomasp thanks for reaching out.
I looked briefly at your code, and I believe the onPolygonClick
is working fine. The issue is in your code where you extract the country's central coords here:
const middleIndex = Math.floor(
clickD.geometry.coordinates[0].length / 2
)
const middleElement = clickD.geometry.coordinates[0][middleIndex]
MultiPolygon geometries have an additional array in the coordinates, one for each polygon, so your code should account for that.
@vasturiano Thank you for your reply. I will check and for the multipolygon, I will change the coordinates. Thanks for your fast reply.
I have tried using the https://globe.gl/example/choropleth-countries/ and I tried to show some information while clicking on the countries. But while I use 'onPolygonClick' , it is not working for some countries in which the "type":"MultiPolygon" in the json.
Can you please check and let me know. test.txt