我正在开发一个应用程序,我在其中绘制了保存在Google Map API上现有MySQL数据库中的最后5个位置(经度和纬度)的路径。有人知道密码吗?提前感谢
发布于 2014-06-25 05:09:10
要从MySql服务器中返回的数据绘制直线,只需使用一条简单的折线:https://developers.google.com/maps/documentation/javascript/examples/polyline-simple
我发现最好方法是创建一个数组var a= [];并将每个较长的数组从服务器推送到数组中。
示例:
var flightPlanCoordinates = [
new google.maps.LatLng(37.772323, -122.214897),
new google.maps.LatLng(21.291982, -157.821856),
new google.maps.LatLng(-18.142599, 178.431),
new google.maps.LatLng(-27.46758, 153.027892)
];然后,您可以轻松地将其添加到地图中或从地图中移除
flightPath.setMap(map);
flightPath.setMap(null);https://stackoverflow.com/questions/24388207
复制相似问题