Skip to main content
1 de 2
Hans Miller
  • 870
  • 4
  • 15
  • 28

como adicionar uma simple polylines ao Mapa Api gmaps v3?

      function initialize() {
        var latlng = new google.maps.LatLng(latitudes, longitudes);

        var options = {
            zoom: 12,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        map = new google.maps.Map(document.getElementById("mapa"), options);
        geocoder = new google.maps.Geocoder();

        if (coord.length > 1) {
            for (var i = 0; i < coord.length; i++) {
                var location = coord[i].split(",");
              
                pontos[i] = new google.maps.LatLng(location[0], location[1]);
               
            }
            
            var flightPath = new google.maps.Polyline({
                path: pontos,
                strokeColor: '#FF0000',
                strokeOpacity: 1.0,
                strokeWeight: 3,
                map: map,
            });

            flightPath.setMap(map);
        }
    }

    initialize();
Hans Miller
  • 870
  • 4
  • 15
  • 28