0
我使用融合表API來繪製地圖樣式。然而在傳說中,一些國家(烏干達和莫桑比克)沒有顯示圖例中顯示的正確顏色。圖例與地圖上的顏色不相對應。 Fusion Tables
下面是用於顯示圖例
<style type="text/css">
#legend {
background-color: #FFF;
margin: 10px;
padding: 5px;
width: 150px;
}
#legend p {
font-weight: bold;
margin-top: 3px;
}
#legend div {
clear: both;
}
.color {
height: 12px;
width: 12px;
margin-right: 3px;
float: left;
display: block;
}
#map-canvas{
width: 700px;
height: 650px;
}
</style>
代碼FOT顯示所述地圖
function initialize() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(-2.358937, 27.618881),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1MXudMo9A8yUjpO89hkac74LzGEKPyA_tDzkWJ3hl'
}
});
layer.setMap(map);
initSelectmenu();
for (column in COLUMN_STYLES) {
break;
}
applyStyle(map, layer, column);
addLegend(map);
google.maps.event.addDomListener(document.getElementById('selector'),
'change', function() {
var selectedColumn = this.value;
applyStyle(map, layer, selectedColumn);
updateLegend(selectedColumn);
});
}
它的工作,謝謝。 – 1088