Google地图第3版中具有起点和终点的折线 [英] Polylines with start and end of location in Google maps v3
本文介绍了Google地图第3版中具有起点和终点的折线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有如下绘制的折线:
var data = JSON.parse(data);
var LineCordinates = new Array();
for (i=0; i<data.length; i++){
LineCordinates[i] = new google.maps.LatLng(data[i].fields.latitude, data[i].fields.longitude);
}
linePath = new google.maps.Polyline({
path: LineCordinates,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
linePath.setMap(map);
}
我想在多边形线的polygon line
和end
的开头放置一个marker
.该怎么做?
I want to place a marker
at the start of the polygon line
and end
of the polygon line. How to do that?
推荐答案
- 有关google.maps.Polyline的文档
-
- documentation on google.maps.Polyline
markers
var startMarker = new google.maps.Marker({ position:linepath.getPath().getAt(0), map:map }); var endMarker = new google.maps.Marker({ position:linepath.getPath().getAt(linepath.getPath().getLength()-1), map:map });
这篇关于Google地图第3版中具有起点和终点的折线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文