【问题标题】:Google Fusion Table Query谷歌融合表查询
【发布时间】:2012-07-18 07:09:19
【问题描述】:

以下 javascript 代码不起作用,它对 google 融合表进行了查询。

$('#map_canvas').gmap({ 'center': new google.maps.LatLng(37.447038,-122.160575), 'zoom': 11, 'mapTypeId' :  google.maps.MapTypeId.ROADMAP, 'callback': function(map) {

$('#map_canvas').gmap('loadFusion', { 'query': { 


    'from': '297050' ,
    'orderBy': ST_DISTANCE('Address', LATLNG(37.447038,-122.160575)),
    'limit':10 } });

var t = setTimeout(function() {$('#dialog').dialog('close');}, 2000);                       
                }
}); 

如果我删除具有 orderby 子句的查询行(如下所示),它可以正常工作

$('#map_canvas').gmap({ 'center': new google.maps.LatLng(37.447038,-122.160575), 'zoom': 11, 'mapTypeId' :  google.maps.MapTypeId.ROADMAP, 'callback': function(map) {

$('#map_canvas').gmap('loadFusion', { 'query': { 


    'from': '297050' ,

    'limit':10 } });

var t = setTimeout(function() {$('#dialog').dialog('close');}, 2000);                       
                }
}); 

请建议热修复此查询

【问题讨论】:

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


    【解决方案1】:

    “orderBy”属性似乎是一个字符串。而不是:

    'from': '297050' ,
    'orderBy': ST_DISTANCE('Address', LATLNG(37.447038,-122.160575)),
    'limit':10 } });
    

    尝试(注意 orderBy 属性周围的双引号 ("):

          query: {
            select: 'Address',
            from: 297050,
            orderBy: "ST_DISTANCE('Address', LATLNG(37.447038,-122.160575))",
            limit:5
          }, 
    

    Working example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      相关资源
      最近更新 更多