-1

Google マップに aiv3 を使用するビジュアライゼーションを作成しています。現在、マップ上に数千のポリゴンといくつかのマーカーをマッピングしています。問題は、描画しようとしている領域の一部が「マルチポリゴン」と見なされることです。たとえば、単一の多角形で分離されて接続されていない複数のエリアを持つ投票区。どうやってこれを描くのですか?

これを試しましたが、レンダリングされていないようです。

var Poly14591; 
var outer = new google.maps.MVCArray([new google.maps.LatLng( 42.862496, -78.151154), new google.maps.LatLng( 42.862251, -78.151319), new google.maps.LatLng( 42.86189, -78.151538), new google.maps.LatLng( 42.861765, -78.151647)]);


var inner = new google.maps.MVCArray([new google.maps.LatLng( 42.867545, -78.151817), new google.maps.LatLng( 42.866978, -78.151813), new google.maps.LatLng( 42.866044, -78.151787), new google.maps.LatLng( 42.864956, -78.151712), new google.maps.LatLng( 42.864231, -78.151709), new google.maps.LatLng( 42.863593, -78.151708)]);

var paths = new google.maps.MVCArray([outer, inner]);

Poly14591 = new google.maps.Polygon({paths:paths,  strokeOpacity: 10.0, strokeWeight: 20, strokeColor: "#FF0000", fillColor: "#FF0000", fillOpacity: 0.35}); 

 Poly14591.setMap(map);
4

1 に答える 1

1

これにより、実際にはまだ単一のGoogleマップポリゴンオブジェクトのコンテキストにある個別のポリゴンをマップできるように見えました。

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple Polygon</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
// This example creates a simple polygon representing the Bermuda Triangle.

function initialize() {
  var mapOptions = {
    zoom: 5,
    center: new google.maps.LatLng(24.886436490787712, -70.2685546875),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var bermudaTriangle;

  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

var Poly14591; 


  var paths = [[new google.maps.LatLng( 42.862496, -78.151154), new google.maps.LatLng( 42.862251, -78.151319), new google.maps.LatLng( 42.86189, -78.151538), new google.maps.LatLng( 42.861765, -78.151647)], [new google.maps.LatLng( 42.867545, -78.151817), new google.maps.LatLng( 42.866978, -78.151813), new google.maps.LatLng( 42.866044, -78.151787), new google.maps.LatLng( 42.864956, -78.151712), new google.maps.LatLng( 42.864231, -78.151709), new google.maps.LatLng( 42.863593, -78.151708)]];


Poly14591 = new google.maps.Polygon({paths:paths,  strokeOpacity: 10.0, strokeWeight: 20, strokeColor: "#FF0000", fillColor: "#FF0000", fillOpacity: 0.35}); 

 Poly14591.setMap(map);

}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>
于 2013-10-28T18:01:59.687 に答える