如何获取我的谷歌地图窗口的边界框坐标 [英] How to get Bounding Box coordinates for my google map window

查看:221
本文介绍了如何获取我的谷歌地图窗口的边界框坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想要做的是通过边界框坐标(左下角和上角)右边)到POSTGRES,并在特定的缩放级别获取生成的地图窗口的POI位置。



我如何实现这个..?有任何想法吗?在api v3中是否有直接的功能?



我已经得到了这个,但这似乎不适用于我。



在Google地图窗口中查找拐角处的经纬度 问题正在使用Google Maps API v2,请使用Google Maps API v3等效 google.maps.Map.getBounds()



在bounds_changed事件触发之前,边界将不可用,因此将其包装在bounds_changed的侦听器中

 google.maps.event.addListener(map,bounds_changed,function(){
//将新边界发送回您的服务器
alert(map bounds {+ map.getBounds());
});


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());
});

这篇关于如何获取我的谷歌地图窗口的边界框坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆