【问题标题】:google map fusion table - simple query to select country polygon is not working谷歌地图融合表 - 选择国家多边形的简单查询不起作用
【发布时间】:2012-07-30 14:29:53
【问题描述】:

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

【问题讨论】:

    标签: google-maps google-maps-api-3 google-fusion-tables


    【解决方案1】:

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

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

     where : "CountryName = 'India'"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多