问题
I'm trying to filter some data in fusion tables and then show the result graphics.
Code is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>map</title>
</head>
<body>
<div id="map-canvas" style="height:500px"></div>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var sloCenter = new google.maps.LatLng(46.119944, 14.815333);
var map = new google.maps.Map(document.getElementById('map-canvas'), { zoom: 8, center: sloCenter });
var layerLUO = new google.maps.FusionTablesLayer({
query: {
select: 'graphics',
from: '1bcKOFVL1kfjLOHGTXibbKzGN-4_Xvy_mj73iteY',
where: "LUO_ID = 51" //if you comment this line it works. LUO_ID is Number type and 51 is a valid data for this column
},
options: {
styleId: 2
},
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</body>
</html>
You can view the table at: https://www.google.com/fusiontables/DataSource?docid=1bcKOFVL1kfjLOHGTXibbKzGN-4_Xvy_mj73iteY
Filter works in the fusiontable GUI.
Can someone explain what the problem is?
回答1:
The "data may still be loading" in my experience means there is something wrong with the query.
Looks to me like your LUO_ID column has a "special" character at the beginning of the name (If I hover over that ID I see a "box" right before the "L". That box seems to be a UTF-8 Byte Order Mark). If I use col0 instead it works (which is the URL you get if you click on "publish"):
example using "col0"
example using LUO_ID
来源:https://stackoverflow.com/questions/20690522/google-maps-fusiontable-query-where-clause-shows-data-may-still-be-loading