返回列表 發帖

有關google map多邊形

想請問一下...
我現在使用了陣列
將使用者所點擊的點存進了陣列
但我要如何將資料取出
並放進polygo的函數內
希望可以做到
當使用者點擊完三個點後
按下建立多邊形按鈕時
可以將多邊形建立出來...

請問有誰對這方面比較有研究的>"<
可以幫忙一下嗎>"<

((因為還沒有完全規劃好,所以程式有些內容是沒有意義的





<html>

<head>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

<script type="text/javascript">

var map;

function initialize() {

  var myLatlng = new google.maps.LatLng(25.040621,121.420169);

  var myOptions = {

    zoom: 15,

    center: myLatlng,

    mapTypeId: google.maps.MapTypeId.ROADMAP

  }

  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  

  google.maps.event.addListener(map, 'click', function(event) {

    placeMarker(event.latLng);
       
       
   
  });

}

  

function placeMarker(location) {

  var clickedLocation = new google.maps.LatLng(location);

  var marker = new google.maps.Marker({

      position: location,

      map: map

  });
  var geoarray = new Array();

      geoarray.push(location);
          
  var geoarrayx = new Array();
      
      geoarrayx.push(location.lat());
      
  var geoarrayy = new Array();
      
      geoarrayy.push(location.lng());
          
  }


       

function Polygon()
{
if (geoarray) {
       
        event > 3 ;
       
    setPaths.push(geoarray);
       
       
       
  }
}

function alertType()
{
alert(document.getElementById("myButton").type)
}


</script>

</head>

<body onload="initialize()">

<div id="map_canvas" style="width:100%; height:85%"></div>
<button id="myButton" type="button" onclick="Polygon()">建立多邊形</button>
<button id="myButton" type="button" onclick="alertType()">區域判定</button>
</body>


</html>

返回列表 回復 發帖