, 내가해야 할 것은 목록 상자에서, 그들은이 방법에의 LatLng를 읽을 수 있습니다 :구글지도 다각형 나도 같은 구글 맵에서 여러 개의 다각형을 그리려는
LAT1, lng1,1 송계, lng2을 1 lat3, lng3,1 LAT1, lng1,2 LAT2, lng2,2 lat3, lng3,2
과 오른쪽의 값에 따라, (1 또는 2)는 대응 latlns 읽을 것이고 폴리곤 그리기, 사실 저는이 작업을하고 있습니다. 폴리곤은 칠해져 있지만 폴리곤은 연결되어 있습니다. 어떻게해야합니까? 제 말은,이 연결선이없는 폴리곤을 어떻게 그리 수 있습니까? 당신이 아주 많이!!!
<script type="text/javascript">
var bermudaTriangle=[];
var places = [];
var geoDataSplit;
function initialize() {
var mapDiv = document.getElementById('map_canvas');
var coords = document.getElementById("selPoly");
var map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(19.3162200000000, -99.2204930000000),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var latlng;
for (var i = 0; i < coords.options.length; i++)
{
var geoData = coords.options[i].text;
geoDataSplit = geoData.split(",");
var counter = geoDataSplit[2];
for (geoDataSplit[2] = 1; geoDataSplit[2] <= 2; geoDataSplit[2]++)
{
if (counter == geoDataSplit[2]) {
latlng = new google.maps.LatLng(parseFloat(geoDataSplit[0]), parseFloat(geoDataSplit[1]));
places.push(latlng);
bermudaTriangle = new google.maps.Polygon({
paths: places,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
}
}
}
bermudaTriangle.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body style="font-family: Arial; border: 0 none;">
<form id="form1" runat="server">
<div>
<asp:ListBox ID="selPoly" runat="server"></asp:ListBox>
</div>
</form>
<div id="map_canvas" style="width: 1024px; height: 768px"></div>
</body>
정확한 값이 VAR 좌표 = document.getElementById를 ("selPoly")'에 의해 반환 무엇' – andresf
는 위도/lngs의 combinatins하고 이드, 예를 들어 19.4646565, -99.43435353,1 그래서 각 값을 얻기 위해 나누기를합니다. – Emilio