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


how set "setmap" function here port code v3? or port v3...

// map recenter, if element outside mapscreen

while ((!map.getbounds().containslatlng(marker.getposition())) & (showallcategoryelements == 0)) {         var newcenterpointlng = (map.getbounds().getcenter().lng() + marker.getposition().lng()) / 2;         var newcenterpointlat = (map.getbounds().getcenter().lat() + marker.getposition().lat()) / 2;         map.panto(new google.maps.latlng(newcenterpointlat, newcenterpointlng));         map.setcenter(new google.maps.latlng(newcenterpointlat, newcenterpointlng));         if (!map.getbounds().containslatlng(marker.getposition())){             map.zoomout();         } 

here example http://d.hatena.ne.jp/tsmsogn/20111216/1324026723 tips: markus.tao.at/geo/google-maps-api-v3-is-in-town/

i import https://github.com/tparkin/google-maps-point-in-polygon js "containslatlng" support

thanks or tips

per api documentation, .getbounds() returns google.maps.latlngbounds not maps.polygon.

you don't need import latlngbounds has contains function.

map.getbounds().contains(marker.getposition()) .... 

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


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -