Skip to main content
adicionou 171 caracteres ao conteúdo
Fonte Link
Hans Miller
  • 870
  • 4
  • 15
  • 28

Nao consigo visualizar a linha no mapa o codigo aparentemente está correto nao quebra em nenhuma linha ,quando visualizo pelo console .mais nao visualiza a linha.

      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();
      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();

Nao consigo visualizar a linha no mapa o codigo aparentemente está correto nao quebra em nenhuma linha ,quando visualizo pelo console .mais nao visualiza a linha.

 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();
Fonte Link
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();