0

我从数据库中获取纬度/经度。我无法在两个距离之间画一条线。这是我的代码

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

我不知道为什么它没有在两个距离之间添加折线。

4

1 回答 1

0

正如上面的评论是实际的解决方案

当你定义你使用的线时,map: map不应该是这样map: map_canvas吗?

于 2014-03-15T10:56:22.423 回答