react-simple-maps
react-simple-maps copied to clipboard
get coordinates of click
Hi,
i'm curious is it possible to get coordinates [lng, lat] of click on a map?
I noticed there's onClick method that i can pass to <Geography />, but at least it does not return directly the location of a click.
Can I calculate it from that somehow?
Thanks in advance!
Hi @mojotti, I think the click coordinates might be a bit trickier. If you are looking to zoom into a country on click you can do this by using the centroid of the country, but the click coordinates themselves would likely require you to do some custom work.
This issue might be relevant: https://github.com/zcreativelabs/react-simple-maps/issues/22