decodedPath is a path(not a Polyline) and doesn't have a method
getPath()
. use:decodedPath.forEach(function(LatLng) { bounds.extend(LatLng); });
- there is no method
setBounds()
, usefitBounds()
instead.
Polyline bounds for Google Maps
-
01-09-2022 - |
Pergunta
How can I get this Google map to resize to the bounds of the Polyline bounds?
I think I am correct to use this:
var bounds = new google.maps.LatLngBounds();
decodedPath.getPath().forEach(function(LatLng) {
bounds.extend(LatLng);
});
map.setBounds(bounds);
but I also think I am putting it in the wrong place.
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow