我觉得我正在接近但在这里错过了一些东西。我的源(多边形)数据在融合表中,我想创建一个 2 选项卡信息窗口并将表中的数据调用到其中。看过一堆例子(见:https ://fusion-tables-users-group.googlegroups.com/attach/ec0975e69edcfb96/infowindow_tabs_5.html?pli=1&view=1&part= 4 一个),所以我希望这是可行的...
我的代码(来自初始化函数)如下。现在,我正在尝试专门从“ROOF_TOTAL”字段中查询值(使用 e.row)以放入选项卡 1(用于初始测试目的)。
function initialize() {
// set the geocoder variable equal to the instance of the google maps geocoder object
geocoder = new google.maps.Geocoder();
//declare variables for map set up
map = new google.maps.Map (document.getElementById('hatfield_map'), {
center: new google.maps.LatLng(42.37098, -72.59818),
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
// Set up a styles array to fill in color for the different polygon types based on the query
// of the value 'TYPE' in the FusionTable...
var layer = new google.maps.FusionTablesLayer({
query:{
select: 'geometry',
from: 'TABLE-ID'
},
// suppressInfoWindows: true
// Set up the stroke color and opacity of all polygons...
styles: [{
polygonOptions: {
strokeColor: '#00ffff',
strokeOpacity: .4,
strokeWeight: .5
}]
suppressInfoWindows: true
});
var infowindow = new google.maps.InfoWindow({
});
// create a custom infowindow, Add a click listener that creates a new infowindow
google.maps.event.addListener(layer, "click", function(e) {
'<ul style="font-size:12px;">' +
'<li><a href="#tab-1"><span>Potential Power Capacity</span>
</a></li>' +
'<li><a href="#tab-2"><span>Two</span></a></li>' +
'</ul>' +
'<div id="tab-1">' +
'<p>' + e.row['TOTAL_ROOF'].value + " "+ '</p>' +
'</div>';
infowindow.setContent(contentString);
infowindow.setPosition(e.latLng);
//Infowindow-opening event handler
infowindow.open(map);
$(".tabs").tabs();
});
layer.setMap(map);
}