Leaflet getBounds() returning longitudes greater than 180
This is due to worldCopyJump being set to false by default. Setting it to true, and the markers will display correctly, as the world won't overlap.
I was seeing a similar thing, except I was processing a map click event via a callback as event.latlng.lng
. Adding worldCopyJump: true
did not fix this issue for me - I was still seeing longitude values greater than 180.
In the end, I called the wrap()
method to the latlng
object:
event.latlng.wrap().lng
which fixed the problem.