简体   繁体   中英

How to get Bounding Box coordinates for my google map window

I am working on a project that includes google maps api v3 and PostGres.

What I want to do is to pass the bounding box coordinates(bottom left and top right) of my map window to POSTGRES and get the POI locations for the generated map window on a particular zoom level.

How can I achieve this.. ? Any Ideas? Is there already a direct function for this in api v3?

I've got this on SO but this does not seem to work for me

Finding the lat-long of the corners in a Google Maps window

The question is using the Google Maps API v2, use the Google Maps API v3 equivalent google.maps.Map.getBounds() .

The bounds will not be available until the bounds_changed event has fired, so wrap it in a listener for bounds_changed

google.maps.event.addListener(map, "bounds_changed", function() {
   // send the new bounds back to your server
   alert("map bounds{"+map.getBounds());
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM