Google Maps v3 map.getBounds().containsLatLng is not a function

怎甘沉沦 提交于 2019-12-01 08:44:55

Per the API documentation, .getbounds() returns a google.maps.LatLngBounds not a maps.Polygon.

You don't need the extra import as LatLngBounds has a contains function.

map.getBounds().contains(marker.getPosition()) ....

https://developers.google.com/maps/documentation/javascript/reference#LatLngBounds

In Google maps v3 we have another metho. Here is the best example for you. https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!