Connect multiple points in Google Maps (waypoints)

0

Good afternoon,

I am populating a map with multiple addresses of a trip stored in my DB.

I would like to connect all these points with a line and I can not.

Could anyone help me?

Follow my code.

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MinhaKey&sensor=false"></script><scripttype="text/javascript">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
            {
            "title": '<%# Eval("Name") %>',
            "lat": '<%# Eval("Latitude") %>',
            "lng": '<%# Eval("Longitude") %>',
            "description": '<%# Eval("Description") %>'
        }
</ItemTemplate>
<SeparatorTemplate>
    ,
</SeparatorTemplate>
</asp:Repeater>
];
</script>
<script type="text/javascript">
    window.onload = function () {
        var mapOptions = {
            center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
            zoom: 13,
            mapTypeId: google.maps.MapTypeId.ROADMAP

        };
        var infoWindow = new google.maps.InfoWindow();
        var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
        for (i = 0; i < markers.length; i++) {
            var data = markers[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);
            var marker = new google.maps.Marker({
                ,
                map: map,
                title: data.title
            });
            (function (marker, data) {
                google.maps.event.addListener(marker, "click", function (e) {
                    infoWindow.setContent(data.description);
                    infoWindow.open(map, marker);

                });
            })(marker, data);
        }
    }
</script>

<div id="dvMap" style="width: 500px; height: 500px">
    
asked by anonymous 10.07.2018 / 22:25

0 answers