Black Lives Matter. Please consider donating to Black Girls Code today.

Lat/Long coordinates displayed on a map

I am looking to see if there is a way when I hover over this map example that the Latitude and Longitude are displayed even if I am not over the plotted data. This example shows when I am over the airline routes, I can get the lat/long data, but when I am not I cannot see the where the mouse is hovering over. Any ideas?

There’s no official way to do this (see How to make ‘shape’ track mouse motion? for more info).

https://codepen.io/etpinard/pen/gxGKgP?editors=0010 has a hacky solution. Use with caution.

Thanks. When I load the example it just shows the map. I don’t see any sort of coordinate system.

Just open the console.

Perfect thank you again.

1 Like