0

我在地图上有谷歌地图 v3 多多边形,我只想删除其中一个。我向 geo.objInfo 添加了引用 ID,现在我想添加删除具有该引用 ID 的多边形。这是代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>


<script>
var data = [{"id":"206671","parentid":"205781","level":"2","name":"Gelderland","continentcode":"","countrycode":"NL","regioncode":"03","city":"","ishq":"0","isdisabled":"0","latitude":"0","longitude":"0","polygons":"{\"type\":\"Polygon\",\"coordinates\":[[[5.931,52.481],[5.939,52.479],[5.97,52.485],[6.002,52.502],[6.031,52.511],[6.043,52.508],[6.05,52.505],[6.056,52.499],[6.064,52.489],[6.082,52.478],[6.089,52.474],[6.095,52.468],[6.104,52.452],[6.112,52.44],[6.133,52.421],[6.135,52.419],[6.136,52.416],[6.135,52.404],[6.12,52.38],[6.087,52.373],[6.084,52.372],[6.082,52.371],[6.087,52.364],[6.087,52.359],[6.078,52.351],[6.069,52.329],[6.068,52.322],[6.071,52.318],[6.081,52.309],[6.086,52.306],[6.107,52.3],[6.125,52.271],[6.124,52.263],[6.122,52.259],[6.124,52.256],[6.128,52.254],[6.139,52.251],[6.144,52.249],[6.146,52.244],[6.142,52.237],[6.142,52.237],[6.142,52.235],[6.143,52.233],[6.146,52.23],[6.154,52.226],[6.158,52.225],[6.16,52.225],[6.167,52.232],[6.177,52.237],[6.18,52.238],[6.189,52.237],[6.259,52.229],[6.323,52.229],[6.332,52.231],[6.347,52.238],[6.382,52.247],[6.411,52.245],[6.417,52.238],[6.418,52.237],[6.466,52.194],[6.495,52.177],[6.519,52.179],[6.558,52.176],[6.586,52.18],[6.592,52.179],[6.597,52.178],[6.601,52.173],[6.602,52.169],[6.602,52.166],[6.606,52.165],[6.61,52.165],[6.646,52.17],[6.654,52.168],[6.663,52.166],[6.667,52.164],[6.669,52.162],[6.671,52.158],[6.672,52.148],[6.672,52.142],[6.662,52.127],[6.76,52.114],[6.771,52.109],[6.771,52.109],[6.766,52.109],[6.75,52.103],[6.732,52.092],[6.727,52.087],[6.719,52.074],[6.711,52.068],[6.699,52.064],[6.688,52.063],[6.68,52.061],[6.673,52.05],[6.673,52.05],[6.675,52.035],[6.691,52.028],[6.712,52.024],[6.778,52.002],[6.804,51.985],[6.809,51.98],[6.811,51.973],[6.811,51.973],[6.81,51.961],[6.805,51.958],[6.798,51.957],[6.789,51.952],[6.767,51.926],[6.743,51.909],[6.716,51.9],[6.628,51.898],[6.528,51.877],[6.479,51.853],[6.462,51.849],[6.442,51.849],[6.378,51.86],[6.378,51.86],[6.386,51.838],[6.386,51.838],[6.382,51.828],[6.345,51.821],[6.342,51.837],[6.325,51.843],[6.287,51.847],[6.282,51.85],[6.271,51.862],[6.264,51.867],[6.256,51.867],[6.225,51.863],[6.191,51.872],[6.159,51.888],[6.127,51.897],[6.093,51.886],[6.093,51.886],[6.105,51.88],[6.142,51.856],[6.156,51.842],[6.156,51.842],[6.14,51.845],[6.116,51.849],[6.084,51.854],[6.043,51.847],[6.029,51.843],[6.008,51.833],[5.989,51.828],[5.948,51.823],[5.931,51.816],[5.928,51.807],[5.928,51.807],[5.95,51.796],[5.964,51.777],[5.964,51.777],[5.962,51.757],[5.945,51.746],[5.944,51.746],[5.941,51.745],[5.916,51.756],[5.912,51.758],[5.894,51.773],[5.89,51.777],[5.887,51.778],[5.882,51.778],[5.872,51.777],[5.863,51.773],[5.863,51.759],[5.76,51.763],[5.69,51.793],[5.671,51.796],[5.661,51.8],[5.649,51.819],[5.643,51.824],[5.599,51.83],[5.535,51.824],[5.52,51.827],[5.501,51.835],[5.482,51.83],[5.462,51.821],[5.441,51.816],[5.401,51.818],[5.381,51.812],[5.373,51.792],[5.368,51.775],[5.355,51.763],[5.337,51.753],[5.318,51.747],[5.135,51.735],[5.126,51.737],[5.137,51.753],[5.137,51.769],[5.1,51.785],[5.089,51.783],[5.065,51.783],[5.028,51.801],[5.012,51.811],[5.01,51.82],[5.009,51.825],[5.008,51.835],[5.011,51.843],[5.011,51.845],[5.004,51.851],[5.033,51.852],[5.11,51.872],[5.121,51.876],[5.121,51.878],[5.121,51.881],[5.12,51.886],[5.118,51.892],[5.153,51.93],[5.158,51.935],[5.183,51.967],[5.197,51.966],[5.221,51.968],[5.239,51.977],[5.254,51.979],[5.311,51.96],[5.331,51.963],[5.361,51.977],[5.383,51.98],[5.409,51.974],[5.42,51.974],[5.43,51.977],[5.449,51.986],[5.462,51.988],[5.505,51.982],[5.582,51.953],[5.616,51.948],[5.619,51.953],[5.62,51.969],[5.618,51.974],[5.616,51.978],[5.612,51.982],[5.605,51.991],[5.585,52.005],[5.572,52.019],[5.563,52.049],[5.565,52.073],[5.563,52.079],[5.562,52.085],[5.553,52.105],[5.537,52.102],[5.541,52.095],[5.541,52.091],[5.539,52.087],[5.535,52.082],[5.531,52.08],[5.527,52.078],[5.523,52.078],[5.52,52.077],[5.509,52.072],[5.5,52.07],[5.472,52.078],[5.47,52.08],[5.469,52.082],[5.476,52.086],[5.481,52.09],[5.484,52.093],[5.49,52.104],[5.498,52.114],[5.508,52.113],[5.509,52.115],[5.509,52.117],[5.508,52.12],[5.508,52.127],[5.513,52.133],[5.513,52.136],[5.51,52.139],[5.502,52.144],[5.494,52.147],[5.49,52.149],[5.482,52.158],[5.475,52.161],[5.454,52.164],[5.43,52.169],[5.424,52.175],[5.425,52.177],[5.427,52.179],[5.433,52.182],[5.437,52.186],[5.439,52.196],[5.402,52.214],[5.397,52.22],[5.399,52.231],[5.403,52.248],[5.409,52.267],[5.426,52.264],[5.497,52.269],[5.533,52.277],[5.552,52.298],[5.563,52.32],[5.579,52.345],[5.601,52.358],[5.628,52.372],[5.655,52.381],[5.689,52.39],[5.733,52.403],[5.771,52.414],[5.796,52.427],[5.815,52.441],[5.838,52.462],[5.855,52.481],[5.866,52.505],[5.867,52.522],[5.867,52.522],[5.875,52.522],[5.891,52.52],[5.904,52.509],[5.925,52.484],[5.931,52.481]]]}"},
{"id":"208053","parentid":"205781","level":"2","name":"Noord-Brabant","continentcode":"","countrycode":"NL","regioncode":"06","city":"","ishq":"0","isdisabled":"0","latitude":"0","longitude":"0","polygons":"{\"type\":\"Polygon\",\"coordinates\":[[[5.52,51.827],[5.535,51.824],[5.599,51.83],[5.643,51.824],[5.649,51.819],[5.661,51.8],[5.671,51.796],[5.69,51.793],[5.76,51.763],[5.863,51.759],[5.883,51.753],[5.88,51.741],[5.888,51.729],[5.904,51.723],[5.945,51.72],[5.96,51.712],[5.973,51.676],[5.989,51.666],[5.982,51.656],[5.987,51.651],[5.997,51.647],[6.006,51.641],[6.026,51.621],[6.027,51.617],[6.031,51.613],[6.044,51.583],[6.049,51.575],[6.049,51.566],[6.034,51.558],[6.009,51.568],[6,51.57],[5.951,51.559],[5.924,51.557],[5.912,51.557],[5.874,51.565],[5.838,51.567],[5.853,51.504],[5.876,51.447],[5.91,51.417],[5.934,51.385],[5.898,51.366],[5.875,51.354],[5.844,51.349],[5.773,51.335],[5.676,51.316],[5.655,51.299],[5.648,51.292],[5.63,51.273],[5.621,51.239],[5.615,51.232],[5.608,51.227],[5.601,51.225],[5.592,51.226],[5.568,51.221],[5.552,51.217],[5.545,51.22],[5.542,51.243],[5.535,51.262],[5.516,51.278],[5.493,51.287],[5.471,51.288],[5.451,51.282],[5.41,51.264],[5.389,51.259],[5.27,51.262],[5.233,51.256],[5.215,51.259],[5.214,51.295],[5.197,51.309],[5.178,51.31],[5.14,51.308],[5.123,51.314],[5.118,51.32],[5.107,51.342],[5.102,51.351],[5.068,51.375],[5.061,51.385],[5.065,51.406],[5.076,51.422],[5.08,51.439],[5.06,51.462],[5.03,51.475],[5.027,51.477],[5.012,51.475],[5.012,51.475],[5.006,51.469],[5.002,51.459],[4.995,51.447],[4.98,51.431],[4.957,51.411],[4.932,51.396],[4.931,51.396],[4.91,51.392],[4.871,51.403],[4.853,51.407],[4.783,51.408],[4.762,51.414],[4.767,51.426],[4.767,51.426],[4.779,51.427],[4.822,51.414],[4.822,51.414],[4.815,51.431],[4.82,51.447],[4.826,51.461],[4.824,51.476],[4.813,51.485],[4.796,51.491],[4.778,51.496],[4.764,51.497],[4.731,51.486],[4.731,51.486],[4.657,51.429],[4.654,51.427],[4.653,51.427],[4.653,51.427],[4.643,51.422],[4.63,51.419],[4.614,51.418],[4.582,51.423],[4.554,51.42],[4.54,51.42],[4.521,51.429],[4.523,51.439],[4.531,51.451],[4.533,51.468],[4.525,51.476],[4.512,51.478],[4.483,51.475],[4.429,51.462],[4.377,51.443],[4.377,51.443],[4.389,51.435],[4.387,51.428],[4.38,51.42],[4.379,51.41],[4.387,51.401],[4.41,51.384],[4.416,51.374],[4.411,51.357],[4.411,51.357],[4.392,51.351],[4.345,51.353],[4.326,51.357],[4.29,51.369],[4.281,51.369],[4.28,51.377],[4.276,51.383],[4.267,51.388],[4.263,51.407],[4.262,51.419],[4.264,51.422],[4.265,51.425],[4.269,51.429],[4.264,51.444],[4.264,51.444],[4.283,51.448],[4.297,51.471],[4.289,51.492],[4.268,51.508],[4.24,51.519],[4.231,51.52],[4.243,51.539],[4.244,51.543],[4.244,51.555],[4.237,51.568],[4.234,51.571],[4.208,51.59],[4.207,51.591],[4.208,51.59],[4.203,51.609],[4.19,51.617],[4.186,51.617],[4.186,51.617],[4.187,51.618],[4.198,51.638],[4.239,51.646],[4.28,51.648],[4.334,51.657],[4.373,51.674],[4.403,51.708],[4.507,51.695],[4.545,51.696],[4.58,51.702],[4.621,51.715],[4.644,51.719],[4.676,51.719],[4.726,51.757],[4.74,51.774],[4.762,51.789],[4.79,51.803],[4.845,51.803],[4.87,51.808],[4.909,51.83],[4.935,51.83],[4.986,51.824],[5.009,51.825],[5.01,51.82],[5.012,51.811],[5.028,51.801],[5.065,51.783],[5.089,51.783],[5.1,51.785],[5.137,51.769],[5.137,51.753],[5.126,51.737],[5.135,51.735],[5.318,51.747],[5.337,51.753],[5.355,51.763],[5.368,51.775],[5.373,51.792],[5.381,51.812],[5.401,51.818],[5.441,51.816],[5.462,51.821],[5.482,51.83],[5.501,51.835],[5.52,51.827]]]}"}

]
$(document).ready(function() {


    var mapOptions = {
      center: new google.maps.LatLng(51.87712314463461,5.5365781250000055),
      zoom: 8,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map"),
        mapOptions);

    var z =0;
    $.each(data, function(c,r){   
        var obj = $.parseJSON(data[z]['polygons']);
        var polygons = obj.coordinates;
        var polygonCoords = new Array();

        $.each(polygons, function(k,v){
            $.each(v, function(i,e){
                if(obj.type == 'MultiPolygon'){
                    $.each(e, function(m,l){
                        polygonCoords.push(new google.maps.LatLng(l[1], l[0]));
                    });
                }
                else{
                    polygonCoords.push(new google.maps.LatLng(e[1], e[0]));
                }

            });

            geo = new google.maps.Polygon({
                paths: polygonCoords,
                strokeColor: "#ED3780",
                strokeOpacity: 0.8,
                strokeWeight: 2,
                fillColor: "#ED3780"

            });
            geo.setMap(map);
            polygonCoords = [];
        });
        z++;
    });

});

</script>
<style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map { height: 100%; width: 80%; float:left;}
    </style>
</head>
<body>
<div id="map"></div>
<div style="float:right">
    <div><a href="#" id="206671">remove 206671</a></div>
    <div><a href="#" id="208053">remove 208053</a></div>
</div>
</body>
</html>

所以 ui.item.id 是参考 id,我想将它推送到多边形,所以我只能删除一个多边形和其他多边形必须说的。

所以我想我将参考 id (geo_id) 添加到地图中,但问题是如何仅删除具有该 geo_id 参考的那个多边形。

更新:这是我的代码链接http://jsfiddle.net/ByPhv/6/

4

1 回答 1

2

您需要保留对数组中所有多边形的引用,然后处理该数组以查找具有适当 id 的那个。然后将其删除。

代码片段:

var gpolygons = [];
var map;

function togglePolygon(id) {
  for (var i = 0; i < gpolygons.length; i++) {
    if (gpolygons[i]._uniqueId == id) {
      if (gpolygons[i].getMap() != null) {
        gpolygons[i].setMap(null);
      } else {
        gpolygons[i].setMap(map);
      }
    }
  }
}

$(document).ready(function() {
  var mapOptions = {
    center: new google.maps.LatLng(51.87712314463461, 5.5365781250000055),
    zoom: 8,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById("map"),
    mapOptions);

  var z = 0;
  $.each(data, function(c, r) {
    var obj = $.parseJSON(data[z]['polygons']);
    var polygons = obj.coordinates;
    var polygonCoords = new Array();
    var uniqueId = data[z]['id'];

    $.each(polygons, function(k, v) {
      $.each(v, function(i, e) {
        if (obj.type == 'MultiPolygon') {
          $.each(e, function(m, l) {
            polygonCoords.push(new google.maps.LatLng(l[1], l[0]));
          });
        } else {
          polygonCoords.push(new google.maps.LatLng(e[1], e[0]));
        }

      });

      geo = new google.maps.Polygon({
        paths: polygonCoords,
        strokeColor: "#ED3780",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#ED3780",
        _uniqueId: uniqueId

      });
      geo.setMap(map);
      gpolygons.push(geo);
      polygonCoords = [];
    });
    z++;
  });

});
var data = [{
  "id": "206671",
  "parentid": "205781",
  "level": "2",
  "name": "Gelderland",
  "continentcode": "",
  "countrycode": "NL",
  "regioncode": "03",
  "city": "",
  "ishq": "0",
  "isdisabled": "0",
  "latitude": "0",
  "longitude": "0",
  "polygons": "{\"type\":\"Polygon\",\"coordinates\":[[[5.931,52.481],[5.939,52.479],[5.97,52.485],[6.002,52.502],[6.031,52.511],[6.043,52.508],[6.05,52.505],[6.056,52.499],[6.064,52.489],[6.082,52.478],[6.089,52.474],[6.095,52.468],[6.104,52.452],[6.112,52.44],[6.133,52.421],[6.135,52.419],[6.136,52.416],[6.135,52.404],[6.12,52.38],[6.087,52.373],[6.084,52.372],[6.082,52.371],[6.087,52.364],[6.087,52.359],[6.078,52.351],[6.069,52.329],[6.068,52.322],[6.071,52.318],[6.081,52.309],[6.086,52.306],[6.107,52.3],[6.125,52.271],[6.124,52.263],[6.122,52.259],[6.124,52.256],[6.128,52.254],[6.139,52.251],[6.144,52.249],[6.146,52.244],[6.142,52.237],[6.142,52.237],[6.142,52.235],[6.143,52.233],[6.146,52.23],[6.154,52.226],[6.158,52.225],[6.16,52.225],[6.167,52.232],[6.177,52.237],[6.18,52.238],[6.189,52.237],[6.259,52.229],[6.323,52.229],[6.332,52.231],[6.347,52.238],[6.382,52.247],[6.411,52.245],[6.417,52.238],[6.418,52.237],[6.466,52.194],[6.495,52.177],[6.519,52.179],[6.558,52.176],[6.586,52.18],[6.592,52.179],[6.597,52.178],[6.601,52.173],[6.602,52.169],[6.602,52.166],[6.606,52.165],[6.61,52.165],[6.646,52.17],[6.654,52.168],[6.663,52.166],[6.667,52.164],[6.669,52.162],[6.671,52.158],[6.672,52.148],[6.672,52.142],[6.662,52.127],[6.76,52.114],[6.771,52.109],[6.771,52.109],[6.766,52.109],[6.75,52.103],[6.732,52.092],[6.727,52.087],[6.719,52.074],[6.711,52.068],[6.699,52.064],[6.688,52.063],[6.68,52.061],[6.673,52.05],[6.673,52.05],[6.675,52.035],[6.691,52.028],[6.712,52.024],[6.778,52.002],[6.804,51.985],[6.809,51.98],[6.811,51.973],[6.811,51.973],[6.81,51.961],[6.805,51.958],[6.798,51.957],[6.789,51.952],[6.767,51.926],[6.743,51.909],[6.716,51.9],[6.628,51.898],[6.528,51.877],[6.479,51.853],[6.462,51.849],[6.442,51.849],[6.378,51.86],[6.378,51.86],[6.386,51.838],[6.386,51.838],[6.382,51.828],[6.345,51.821],[6.342,51.837],[6.325,51.843],[6.287,51.847],[6.282,51.85],[6.271,51.862],[6.264,51.867],[6.256,51.867],[6.225,51.863],[6.191,51.872],[6.159,51.888],[6.127,51.897],[6.093,51.886],[6.093,51.886],[6.105,51.88],[6.142,51.856],[6.156,51.842],[6.156,51.842],[6.14,51.845],[6.116,51.849],[6.084,51.854],[6.043,51.847],[6.029,51.843],[6.008,51.833],[5.989,51.828],[5.948,51.823],[5.931,51.816],[5.928,51.807],[5.928,51.807],[5.95,51.796],[5.964,51.777],[5.964,51.777],[5.962,51.757],[5.945,51.746],[5.944,51.746],[5.941,51.745],[5.916,51.756],[5.912,51.758],[5.894,51.773],[5.89,51.777],[5.887,51.778],[5.882,51.778],[5.872,51.777],[5.863,51.773],[5.863,51.759],[5.76,51.763],[5.69,51.793],[5.671,51.796],[5.661,51.8],[5.649,51.819],[5.643,51.824],[5.599,51.83],[5.535,51.824],[5.52,51.827],[5.501,51.835],[5.482,51.83],[5.462,51.821],[5.441,51.816],[5.401,51.818],[5.381,51.812],[5.373,51.792],[5.368,51.775],[5.355,51.763],[5.337,51.753],[5.318,51.747],[5.135,51.735],[5.126,51.737],[5.137,51.753],[5.137,51.769],[5.1,51.785],[5.089,51.783],[5.065,51.783],[5.028,51.801],[5.012,51.811],[5.01,51.82],[5.009,51.825],[5.008,51.835],[5.011,51.843],[5.011,51.845],[5.004,51.851],[5.033,51.852],[5.11,51.872],[5.121,51.876],[5.121,51.878],[5.121,51.881],[5.12,51.886],[5.118,51.892],[5.153,51.93],[5.158,51.935],[5.183,51.967],[5.197,51.966],[5.221,51.968],[5.239,51.977],[5.254,51.979],[5.311,51.96],[5.331,51.963],[5.361,51.977],[5.383,51.98],[5.409,51.974],[5.42,51.974],[5.43,51.977],[5.449,51.986],[5.462,51.988],[5.505,51.982],[5.582,51.953],[5.616,51.948],[5.619,51.953],[5.62,51.969],[5.618,51.974],[5.616,51.978],[5.612,51.982],[5.605,51.991],[5.585,52.005],[5.572,52.019],[5.563,52.049],[5.565,52.073],[5.563,52.079],[5.562,52.085],[5.553,52.105],[5.537,52.102],[5.541,52.095],[5.541,52.091],[5.539,52.087],[5.535,52.082],[5.531,52.08],[5.527,52.078],[5.523,52.078],[5.52,52.077],[5.509,52.072],[5.5,52.07],[5.472,52.078],[5.47,52.08],[5.469,52.082],[5.476,52.086],[5.481,52.09],[5.484,52.093],[5.49,52.104],[5.498,52.114],[5.508,52.113],[5.509,52.115],[5.509,52.117],[5.508,52.12],[5.508,52.127],[5.513,52.133],[5.513,52.136],[5.51,52.139],[5.502,52.144],[5.494,52.147],[5.49,52.149],[5.482,52.158],[5.475,52.161],[5.454,52.164],[5.43,52.169],[5.424,52.175],[5.425,52.177],[5.427,52.179],[5.433,52.182],[5.437,52.186],[5.439,52.196],[5.402,52.214],[5.397,52.22],[5.399,52.231],[5.403,52.248],[5.409,52.267],[5.426,52.264],[5.497,52.269],[5.533,52.277],[5.552,52.298],[5.563,52.32],[5.579,52.345],[5.601,52.358],[5.628,52.372],[5.655,52.381],[5.689,52.39],[5.733,52.403],[5.771,52.414],[5.796,52.427],[5.815,52.441],[5.838,52.462],[5.855,52.481],[5.866,52.505],[5.867,52.522],[5.867,52.522],[5.875,52.522],[5.891,52.52],[5.904,52.509],[5.925,52.484],[5.931,52.481]]]}"
}, {
  "id": "208053",
  "parentid": "205781",
  "level": "2",
  "name": "Noord-Brabant",
  "continentcode": "",
  "countrycode": "NL",
  "regioncode": "06",
  "city": "",
  "ishq": "0",
  "isdisabled": "0",
  "latitude": "0",
  "longitude": "0",
  "polygons": "{\"type\":\"Polygon\",\"coordinates\":[[[5.52,51.827],[5.535,51.824],[5.599,51.83],[5.643,51.824],[5.649,51.819],[5.661,51.8],[5.671,51.796],[5.69,51.793],[5.76,51.763],[5.863,51.759],[5.883,51.753],[5.88,51.741],[5.888,51.729],[5.904,51.723],[5.945,51.72],[5.96,51.712],[5.973,51.676],[5.989,51.666],[5.982,51.656],[5.987,51.651],[5.997,51.647],[6.006,51.641],[6.026,51.621],[6.027,51.617],[6.031,51.613],[6.044,51.583],[6.049,51.575],[6.049,51.566],[6.034,51.558],[6.009,51.568],[6,51.57],[5.951,51.559],[5.924,51.557],[5.912,51.557],[5.874,51.565],[5.838,51.567],[5.853,51.504],[5.876,51.447],[5.91,51.417],[5.934,51.385],[5.898,51.366],[5.875,51.354],[5.844,51.349],[5.773,51.335],[5.676,51.316],[5.655,51.299],[5.648,51.292],[5.63,51.273],[5.621,51.239],[5.615,51.232],[5.608,51.227],[5.601,51.225],[5.592,51.226],[5.568,51.221],[5.552,51.217],[5.545,51.22],[5.542,51.243],[5.535,51.262],[5.516,51.278],[5.493,51.287],[5.471,51.288],[5.451,51.282],[5.41,51.264],[5.389,51.259],[5.27,51.262],[5.233,51.256],[5.215,51.259],[5.214,51.295],[5.197,51.309],[5.178,51.31],[5.14,51.308],[5.123,51.314],[5.118,51.32],[5.107,51.342],[5.102,51.351],[5.068,51.375],[5.061,51.385],[5.065,51.406],[5.076,51.422],[5.08,51.439],[5.06,51.462],[5.03,51.475],[5.027,51.477],[5.012,51.475],[5.012,51.475],[5.006,51.469],[5.002,51.459],[4.995,51.447],[4.98,51.431],[4.957,51.411],[4.932,51.396],[4.931,51.396],[4.91,51.392],[4.871,51.403],[4.853,51.407],[4.783,51.408],[4.762,51.414],[4.767,51.426],[4.767,51.426],[4.779,51.427],[4.822,51.414],[4.822,51.414],[4.815,51.431],[4.82,51.447],[4.826,51.461],[4.824,51.476],[4.813,51.485],[4.796,51.491],[4.778,51.496],[4.764,51.497],[4.731,51.486],[4.731,51.486],[4.657,51.429],[4.654,51.427],[4.653,51.427],[4.653,51.427],[4.643,51.422],[4.63,51.419],[4.614,51.418],[4.582,51.423],[4.554,51.42],[4.54,51.42],[4.521,51.429],[4.523,51.439],[4.531,51.451],[4.533,51.468],[4.525,51.476],[4.512,51.478],[4.483,51.475],[4.429,51.462],[4.377,51.443],[4.377,51.443],[4.389,51.435],[4.387,51.428],[4.38,51.42],[4.379,51.41],[4.387,51.401],[4.41,51.384],[4.416,51.374],[4.411,51.357],[4.411,51.357],[4.392,51.351],[4.345,51.353],[4.326,51.357],[4.29,51.369],[4.281,51.369],[4.28,51.377],[4.276,51.383],[4.267,51.388],[4.263,51.407],[4.262,51.419],[4.264,51.422],[4.265,51.425],[4.269,51.429],[4.264,51.444],[4.264,51.444],[4.283,51.448],[4.297,51.471],[4.289,51.492],[4.268,51.508],[4.24,51.519],[4.231,51.52],[4.243,51.539],[4.244,51.543],[4.244,51.555],[4.237,51.568],[4.234,51.571],[4.208,51.59],[4.207,51.591],[4.208,51.59],[4.203,51.609],[4.19,51.617],[4.186,51.617],[4.186,51.617],[4.187,51.618],[4.198,51.638],[4.239,51.646],[4.28,51.648],[4.334,51.657],[4.373,51.674],[4.403,51.708],[4.507,51.695],[4.545,51.696],[4.58,51.702],[4.621,51.715],[4.644,51.719],[4.676,51.719],[4.726,51.757],[4.74,51.774],[4.762,51.789],[4.79,51.803],[4.845,51.803],[4.87,51.808],[4.909,51.83],[4.935,51.83],[4.986,51.824],[5.009,51.825],[5.01,51.82],[5.012,51.811],[5.028,51.801],[5.065,51.783],[5.089,51.783],[5.1,51.785],[5.137,51.769],[5.137,51.753],[5.126,51.737],[5.135,51.735],[5.318,51.747],[5.337,51.753],[5.355,51.763],[5.368,51.775],[5.373,51.792],[5.381,51.812],[5.401,51.818],[5.441,51.816],[5.462,51.821],[5.482,51.83],[5.501,51.835],[5.52,51.827]]]}"
}];
html {
  height: 100%
}
body {
  height: 100%;
  margin: 0;
  padding: 0
}
#map {
  height: 100%;
  width: 80%;
  float: left;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js"></script>
<div id="map"></div>
<div style="float:right">
  <div><a href="#" id="206671" onclick="togglePolygon(206671);">toggle 206671</a>
  </div>
  <div><a href="#" id="208053" onclick="togglePolygon(208053);">toggle 208053</a>
  </div>
</div>

于 2013-05-14T12:41:50.630 回答