Reputation: 477
I want to get coordinates of map's corners like shown in the image
Upvotes: 0
Views: 536
Reputation: 31912
Use map.getBounds()
. This returns a LatLngBounds object. From that you can then use getNorthEast()
and getSouthWest()
to get those corners. These aren't the ones you want though, so you'll have to do a little bit of logic to figure out the North West and South East parts. i.e. use the lat()
of the NorthEast corner with the lon()
of the SouthWest corner for the NorthWest coordinate, and the lon()
of the NorthEast corner with the lat()
of the SouthWest corner for the SouthEast coordinate.
Upvotes: 3