Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 JQuery Mobile 应用程序中使用 Google Map 插件。此应用程序目前正在特定纬度/经度点添加标记。我需要在这些点之间画一条线。有没有办法用谷歌地图插件做到这一点?如果是这样,怎么做?
谢谢!
假设您需要在markerA和markerB之间有一条线,以下应该可以工作:
$('#map_canvas').gmap('addShape', 'Polyline', { 'strokeColor': "#FF0000", 'strokeWeight': 2, 'path': [markerA.getPosition(), markerB.getPosition()] });
如果您已经在某些变量中拥有标记的 LatLng,当然您可以直接将它们放入路径数组中。