caschw
caschw

Reputation: 566

How to detect latitude and longitude edges of map container?

Using Google or Bing maps, how would I detect the latitude and longitude lines of the edges of the map? I need to know this so I can query a database and return all locations (the database contains proper geo-coded locations) that are within the border of the map.

Upvotes: 2

Views: 2597

Answers (1)

Alastair Aitchison
Alastair Aitchison

Reputation: 3532

In Bing Maps, you can use the getBounds() method of the map to return a LocationRect rectangle created from the corners of the current map view: http://msdn.microsoft.com/en-us/library/gg427609.aspx

In Google Maps, the equivalent method is also called getBounds(), and returns a LatLngBounds: http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

Upvotes: 3

Related Questions