在邮政编码边界上显示自定义多边形

时间:2014-04-29 13:30:40

标签: google-maps-api-3

我想显示邮政编码边界,​​在那个边界上我想在那个

上显示自定义多边形

这是我的代码

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Fusion Tables styling</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>
var map, layer;
var tableid = 2996349;
var triangleCoords = [
new google.maps.LatLng(37.2684,-119.956),
new google.maps.LatLng(37.5137,-119.958),
new google.maps.LatLng(37.417, -120.149),
new google.maps.LatLng(37.3957, -119.745)
];
 var bermudaTriangle;
function initialize() {

 var usa=new google.maps.LatLng(37.23032838760389, -118.65234375);

  map = new google.maps.Map(document.getElementById('map-canvas'), {
  center:usa,
  zoom: 4
});


bermudaTriangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: 'blue',
fillOpacity: 0.35
 });
    layer = new google.maps.FusionTablesLayer(tableid);
    layer.setQuery("SELECT 'geometry' FROM " + tableid);
    layer.setMap(map);
    bermudaTriangle.setMap(map);


}

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

</script>
</head>
 <body>
<div id="map-canvas"></div>
</body>
 </html>`

但它只显示自定义多边形而不是边界可以共享一些示例代码以显示相同的

0 个答案:

没有答案