Вопрос

I am getting the latitude/longitude from the DB. I am unable to draw a line between two distances. Here is my code

var auto_refresh = setInterval(
function () {
    $.get('http://developer.allsecure.me/Location/longlat', function (data) {
        map_canvas.setCenter(new google.maps.LatLng(data.startlat, data.startlong));

        clearMarkers();

        setMarker(map_canvas, 'center', new google.maps.LatLng(data.startlat, data.startlong), '', '/img/device.png', '', '', true);

        var line = new google.maps.Polyline({
            path: [new google.maps.LatLng(data.startlat, data.startlong), new google.maps.LatLng(data.endlat, data.endlong)],
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 10,
            map: map
        });
    }, 'json');

}, 1000);

I don't know why it isn't adding the polylines between the two distances.

Это было полезно?

Решение

As the comment above was the actual solution

When you define the line you use map: map shouldn't this be map: map_canvas?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top