0

我创建了一个新的融合表。我想触发查询以检索具有特定颜色的特定国家多边形。但它不起作用。我确定我在 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> 
4

1 回答 1

1

您需要引用 where 子句。此外,这些列区分大小写(您的表没有“countryName”列,它是“CountryName”

因此,只需在这一行中切换:

 where : "CountryName = 'India'"
于 2012-07-30T16:20:45.770 回答