开发者

getbounds on google api v2 is not working

开发者 https://www.devze.com 2023-01-31 19:30 出处:网络
getbounds() return error开发者_StackOverflow社区 on firebug. May I know what is the problem? Thanks.

getbounds() return error开发者_StackOverflow社区 on firebug. May I know what is the problem? Thanks.

map=new GMap2(document.getElementbyId('map'));
map.setCenter(new GLatLng(la,lo),15);
map.addControl(new GLargeMapControl3D());
map.addControl(new GMapTypeControl());
map.enableScrollWheelZoom();
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var southEast = bounds.getSouthEast();
var northWest = bounds.getNorthWest();

Firebug states that getSouthWest() is not a functions. Thank you.


Maybe you should wait until the map fires load event.


I think the simple problem here is that GLatLngBounds only has getSouthWest() and getNorthEast() methods, not getSouthEast() and getNorthWest() (see the API reference). Are you sure Firebug is giving you an error on getSouthWest? I am able to get your code working without an error if I remove the last two function calls.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号