【问题标题】:getLocation to the center of fusion table layer geometrygetLocation 到融合表层几何的中心
【发布时间】:2013-06-17 03:27:35
【问题描述】:

我有一个包含几何列的融合表,如何获取所选几何的中心纬度?

这是我的融合表层代码

   var testlayer=new google.maps.FusionTablesLayer({
    query:{
        select: 'geometry',
        from: 'code',
        where: 'KEC_NO='+number+''
    },
    styles:[
        {polygonOptions:{fillColor:'#FF00FF'}}
           ]
    });
    testlayer.setMap(map);

上面代码的返回是单个多边形。

【问题讨论】:

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


    【解决方案1】:

    FusionTablesLayers 不会缩放到选定的几何图形。您可以在表格中查询地理信息,从中创建 google.maps.LatLngBounds,然后使用 google.maps.Map.fitBounds 居中并缩放地图以适应它。

    Example (uses GViz to query the FusionTable for KML, then geoxml3 to parse the KML)

    【讨论】:

    • 已解决。 .我使用 HTML 5 地理定位来获取我的多边形图层的纬度和经度。 . :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-17
    • 1970-01-01
    • 1970-01-01
    • 2014-01-23
    相关资源
    最近更新 更多