我想从一个标记到多个标记绘制折线,并且还要绑定到它们的标记。与此example类似。在此示例中,所有折线都相互连接。我想要将所有折线分开。 我有一组纬度和经度数组。我想用不同的折线绘制每个数组,并用尊重的标记将它们绑定。
string aresultlist = File.ReadAllLines(data).ToString();
var bresultlist = aresultlist.Split().Select(s => Convert.ToInt32(s));
List<int> resultlist = bresultlist.ToList();
答案 0 :(得分:0)
希望这会有所帮助:
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 1,
center: {lat: 24.886, lng: -70.268},
mapTypeId: 'terrain'
});
var polyline1 = [
{lat: 25.774252, lng: -80.190262},
{lat: 18.466465, lng: -66.118292},
{lat: 32.321384, lng: -64.75737}
];
var polyline2 = [
{lat: 32.321384, lng: -64.75737},
{lat: 36.321384, lng: -88.75737}
];
var polyline3 = [
{lat:20.466465 , lng: -68.118292},
{lat: 34.321384, lng:-66.75737 },
{lat: 27.774252, lng: -82.190262}
];
new google.maps.Polygon({
map: map,
paths: polyline1,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
geodesic: true
});
new google.maps.Polygon({
map: map,
paths: polyline2,
strokeColor: '#0000FF',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#0000FF',
fillOpacity: 0.35,
geodesic: false
});
new google.maps.Polygon({
map: map,
paths: polyline3,
strokeColor: '#0000FF',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#0000FF',
fillOpacity: 0.35,
geodesic: false
});
}
&#13;
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
&#13;
<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer
src="https://maps.googleapis.com/maps/api/js?callback=initMap">
</script>
&#13;