Answer the question
In order to leave comments, you need to log in
Leaflet - how to get the latitude and longitude data of the extreme left, right, top and bottom of the visible area of the map?
Hello.
Leafleft - https://leafletjs.com/ has a function - getCenter , which displays the latitude and longitude of the center of the map at the currently viewed scale and size.
Question:
How to get the extreme upper and lower extreme latitude of the visible area, the extreme right and left longitude?
Answer the question
In order to leave comments, you need to log in
first you need to get the "bounds" object (Bounds)
and then from this object we can get the values \u200b\u200bthat we need
LatLngBounds Methods (latitude/longitude of the bounds)
bounds.getSouthWest() // юго-западная точка
bounds.getSouthEast() // юго-восточная точка
bounds.getNorthEast() // северо-восточная точка
bounds.getNorthWest() // северо-западная точка
map.getBounds().getSouthWest().lat // широта юго-западной точки
map.getBounds().getNorthEast().lng // долгота северо-восточной точки
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question