我创建了一个新的融合表。我想触发查询以检索具有特定颜色的特定国家多边形。但它不起作用。我确信我在where子句中做错了什么。 以下是我的代码:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Fusion Tables Layer Example: Basic Fusion Tables Layer</title>
<link href="http://code.google.com/apis/fusiontables/docs/samples/style/default.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
function initialize() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(37.4, -122.1),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1hFPiPmQilakQ4zESVCJqq9ENmeo5e_EJXy_Usy8',
where : countryName = 'India'
},
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
答案 0 :(得分:1)
您需要引用where子句。此外,列是区分大小写的(您的表没有“countryName”列,它是“CountryName”
因此,只需切换此行:
where : "CountryName = 'India'"