JavaScript:如何解码MySQL数据库中的折线

时间:2014-12-27 09:16:51

标签: javascript mysql google-maps-api-3 encode polyline

我想从数据库加载折线路径。我在变量中使用一个编码折线尝试了它,但它没有显示折线。这是我的代码段:



var polylayer = ['munoEub_uSEGDFMKLJYSXRa@Y`@Xq@e@p@d@w@i@v@h@eAu@']

addEncodedPaths( encodedFlightPaths );

function addEncodedPaths( encodedPaths ) {
    for( var i = 0, n = encodedPaths.length;  i < n;  i++ ) {
        addEncodedPath( encodedPaths[i] );
    }
}

function addEncodedPath( encodedPath ) {
    var path = google.maps.geometry.encoding.decodePath( encodedPath );

    var polyline = new google.maps.Polyline({
        path: path,
        strokeColor: "#0000FF",
        strokeOpacity: 1.0,
        strokeWeight: 2
    });
    polyline.setMap( map );
}
&#13;
&#13;
&#13;

0 个答案:

没有答案