这与Fusion Table Layer with polygons AND markers问题有关。我试过(下面)想法用一层点/图标覆盖一层多边形。但是,我只获得了多边形。
function initialize() {
var MAP = {
zoom : 5,
center : new google.maps.LatLng(-25.610111, 134.354806),
mapTypeId : google.maps.MapTypeId.ROADMAP
},
MAP = new google.maps.Map(document.getElementById("map-canvas"), MAP);
var L1 = new google.maps.FusionTablesLayer({
query : {
select : "geometry",
from : "1ertEwm-1bMBhpEwHhtNYT47HQ9k2ki_6sRa-UQ"
},
suppressInfoWindows : false,
styles : [{
where : "birds > 300",
polygonOptions : {
fillColor : "#FF0000",
fillOpacity : .4
}
}, {
where : "birds <= 300",
polygonOptions : {
fillColor : "#0000FF",
fillOpacity : .4
}
}
]
});
var L2 = new google.maps.FusionTablesLayer({
query : {
select : "geometry",
from : "1ertEwm-1bMBhpEwHhtNYT47HQ9k2ki_6sRa-UQ"
},
suppressInfoWindows : false,
styles : [{
where : "population > 5",
markerOptions : {
iconName : "snowflake_simple"
}
}, {
where : "population <= 5",
markerOptions : {
iconName : "sunny"
}
}
]
});
L1.setMap(MAP);
L2.setMap(MAP);
}
google.maps.event.addDomListener(window, "load", initialize);
我尝试了各种不同的方法,包括在FusionTablesLayer调用中指定地图。要么我得到多边形,要么得到积分,但不是两者。
我在哪里错了?
我在其中运行的HTML框架如下:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Fusion Tables layers</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&signed_in=true"></script>
<script src="coldfusion.js"></script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
LATER
&#34;注意:样式只能应用于每个地图的单个Fusion Tables图层。您最多可以为该图层应用五种样式。&#34; - FusionTablesLayer documentation
在那里,我试图在点上的多边形和样式上设置样式。叹息。