此问题的完整代码位于测试应用程序中
我正在尝试使用带有查询的谷歌融合表来显示数据库的子集。Project 类型 (handlePrjTypeKey) 的代码会产生预期的结果;但是,为 City 选择的代码没有(没有项目显示)。我花了相当多的时间试图找出原因并且不知所措。我已确认可以使用以下函数中使用的相同查询字符串手动查询 Google Fusion Tables 中的表并获得预期结果,但程序版本无法正常工作。
任何帮助或建议将不胜感激!
function handlePrjTypeKey(queryString)
{
// Google Fusion PointFeat table
var pntLayer = new google.maps.FusionTablesLayer({
query: {
select: 'ProjectType',
from: pntCityTableId,
where: queryString
},
map: GlobalMap
});
// Google Fusion LineFeat table
var linLayer = new google.maps.FusionTablesLayer({
query: {
select: 'ProjectType',
from: linCityTableId,
where: queryString
},
styles: [{
polylineOptions: {
strokeColor: "#FF0000",
strokeWeight: "2"
}
}],
map: GlobalMap
});
// Google Fusion AreaFeat table
var areaLayer = new google.maps.FusionTablesLayer({
query: {
select: 'ProjectType',
from: areCityTableId,
where: queryString
},
map: GlobalMap
});
}
function handleCityKey(queryString)
{
// Google Fusion PointFeat table
var pntLayer = new google.maps.FusionTablesLayer({
query: {
select: 'CityName',
from: pntCityTableId,
where: queryString
},
map: GlobalMap
});
// Google Fusion LineFeat table
var linLayer = new google.maps.FusionTablesLayer({
query: {
select: 'CityName',
from: linCityTableId,
where: queryString
},
styles: [{
polylineOptions: {
strokeColor: "#FF0000",
strokeWeight: "2"
}
}],
map: GlobalMap
});
// Google Fusion AreaFeat table
var areaLayer = new google.maps.FusionTablesLayer({
query: {
select: 'CityName',
from: areCityTableId,
where: queryString
},
map: GlobalMap
});
}
表 ID 在 right.html 文件中定义,如图所示
// To simplify my life I decided to just use a couple of global variables instead of passing parameters!
// These three tables have the project geometry merged with the project data
var pntTableId = '16uiLeoNQIIonp6JxsOpKDxzT1S391pP9BZ-RnVQ'; // The fusiontables table id, encrypted form, needed to access the project data
var linTableId = '1EHx68dEBTB4-uCoW1KdjhV6n_40QYMNq3VcwGjI';
var areTableId = '1mP2PIX-C3s9y3kqzicl0xrCzZyDNAs78tH04aYc';
// These three tables have the project geometry merged with the project data and the cities impacted
var pntCityTableId = '1LV4c5hf4TGei9O90jge3guhZJ5YDVVMjiOgqI0w'; // The fusiontables table id, encrypted form, needed to access the project data
var linCityTableId = '1zq9xgR8mnebZGbpjWYU16PpdxzohKpxjLi9JtDk';
var areCityTableId = '1xyOrrqbvVjQ30jEut0Fc68T4rv5prZ9cFXU4fQk';
var datalink = null;
var GlobalMap = null;