I've created a table in Google Fusion from shape file (converted to kml). I can show the geometry of all rows in Google Maps v3. But the problem is I can't filter the geometry (here is boundary of countries) by country's name.
I've followed the tutorial here but it looks like that ignores the where clause.
Here is my sample code, I hope someone will help me to filter geometry by name.
Another question: What is the result of Fusion Table query? Is it JSON type, and how can I get it?
Code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Fusion Tables layers</title>
<style type="text/css">
#map-canvas {width: 1000px; height: 600px}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map, layer;
function initialize() {
var chicago = new google.maps.LatLng(33.420, 106.514);
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: chicago,
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
layer = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1emmdckIBQOQbTa9fik0naDOWGhnK4o3Xo_XRiys',
where: '"Name" = "Viet Nam"'
//query: "select geometry from 1emmdckIBQOQbTa9fik0naDOWGhnK4o3Xo_XRiys where name = China"
}
});
layer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
This works for me (inverted the ' and "):
layer = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1emmdckIBQOQbTa9fik0naDOWGhnK4o3Xo_XRiys',
where: "'Name' = 'Viet Nam'"
}
});