当我尝试使用docid代替表id时,我得到407代理错误。我的理解是,您不需要对选择记录进行身份验证,仅用于插入,更新和删除。当我使用表id时,sql查询挂起。我在Firebug控制台窗口中发现了这些错误。
当表未合并时,我能够从两个表(levels_a.txt和amp; levels_b.txt)接收数据。合并时也是如此。请参阅下面的代码。
google.load("visualization", "1", { packages: ["corechart", "annotatedtimeline"] });
var map, layer;
var tableID = 3013978;
//var tableID = "1RWnj3geWmOXHcedu8RUeyb1v4ZjZz3YWNpK0MDs";
var location_column = 'geometry';
var name, PID;
var chart;
var jqXHR;
var formatter_long;
var dt;
var rows;
var plot;
var scatter_chart;
var g;
function initialize() {
var latlng = new google.maps.LatLng(53.760861, -98.813876);
var myOptions = {
center: latlng,
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
mapTypeControl: true,
mapTypeControlOptions: {
mapTypeIds: [
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.HYBRID,
google.maps.MapTypeId.TERRAIN
],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
overviewMapControl: true,
overviewMapControlOptions: {
opened: true
}
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
layer = new google.maps.FusionTablesLayer({
query: {
select: location_column,
from: tableID
}
});
layer.setMap(map);
google.maps.event.addListener(layer, 'click', function (e) {
name = e.row['name'].value;
PID = e.row['WELL_PID'].value;
drawChart(PID, name);
});
}
function drawChart(PID, name) {
/*
var queryURL = "http://www.google.com/fusiontables/api/query?sql=";
var queryTail = '&jsonCallback=?';
var whereClause = "WHERE 'WELL_PID'=" + PID; // table id 3004502
var query = "SELECT 'Date','Level' FROM 3004502 " + whereClause;
var queryText = encodeURIComponent(query);
*/
//--------------------------------------------------------------------------------------------//
var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=';
var queryUrlTail = '&jsonCallback=?';
var whereClause = "WHERE 'WELL_PID'=" + PID; // table id 3004502
var query = "SELECT 'Date','Level' FROM 1RrJI_dWPjrmJ7A6xD_GcZ3nxIso9ZTvOPWp0suI " + whereClause;
var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
var jqxhr = $.get(queryurl, dataHandler, "jsonp");
//console.log(jqxhr);
/*
var rows;
var items = [];
var arr = [];
var str;
$.ajax({
type: "GET",
url: queryURL + queryText + queryTail,
cache: false,
dataType: 'jsonp',
jsonpCallback: 'jsonpCallback',
success: function (data) {
rows = data.table.rows;
for (i = 0; i < rows.length; i++) {
var temp = rows[i];
var this_date;
items.push([parseDate(temp[0]), temp[1]]);
}
processData(items);
},
error: function () { alert("Please wait until chart loads before clicking on another well location."); }
});
*/
}
function dataHandler(d) {
var items = [];
var rows = d.table.rows;
for (i = 0; i < rows.length; i++) {
var temp = rows[i];
var this_date;
items.push([parseDate(temp[0]), temp[1]]);
}
processData(items);
}
function processData(res) {
var options = {
strokeWidth: 0.0,
displayAnnotations: true,
labelsKMB: false,
rollPeriod: 14,
showRangeSelector: true,
connectSeparatedPoints: false,
drawPoints: true,
stepPlot: false,
pointSize: 1,
digitsAfterDecimal: 3
};
var dat = new google.visualization.DataTable();
dat.addColumn('date', 'Date');
dat.addColumn('number', 'Water Level');
console.log(res.toString());
if (res.toString() === "") {
alert("Sorry, there is no data available for this well. Please check back at a later time.");
$("#dg_div").empty();
} else {
dat.addRows(res);
if (g) {
g.destroy();
}
g = new Dygraph(document.getElementById("dg_div"), dat, options);
}
}
我想执行以下连接:
geography.kml
name | geometry | description
well_name_and_PID.csv
WELL_PID | Name_Short
levels_a.txt
WELL_PID | Date | Level
levels_b.txt
WELL_PID | Date | Level
Joins:
[geography.kml].name -> [well_name_and_PID.csv].Name_Short
[well_name_and_PID.csv].WELL_PID -> [levels_a.txt].WELL_PID
[well_name_and_PID.csv].WELL_PID -> [levels_b.txt].WELL_PID
拥有两个级别文件背后的理由是该文件将超过100兆的表限。这两个文件包含类似的信息。
像往常一样,非常感谢任何帮助。
提前致谢, 迈克尔