0

I'm wondering if it's possible to access the latlng values that are returned from the query below. The query itself works fine, but for what I'm building I would need to know the center location of a country.

I know how to find the center latlng based on a collection of latlng values, but I just can't find a way how to access the returned latlng values from the fusion table query.

Not sure if that is even possible? I tried to do console.log(layer) and see if I could find an array or so with the returned latlng values, but unless I'm missing something it's not there.

If what I want is possible, how would I access the those values? Or any other suggestion on how to access the latng values for the polygons?

var layer = new google.maps.FusionTablesLayer({
query: {
  select: 'geometry',
  from: '17mMrmy5DaEPNlPabZeKrTmY3e8cP7-qCFrrFyxk',
  where: "iso_a3 IN ('AFG', 'NZL')"
},
styles: [{
  polygonOptions: {
    fillColor: '#ff22ff',
    fillOpacity: 0.3
  }
}]
});

layer.setMap(map);
4

1 回答 1

0

除了单击事件外,您无法从 FusionTableLayer 访问信息。

单击此地图中的多边形,您将在信息窗口中看到坐标。

您可以使用 GViz 或 FusionTables API v1.0 查询 FusionTable 以获取所需的信息。

这是一个使用 FusionTables API v1.0 解析坐标并将它们呈现在地图上作为原生 Google Maps Javascript API v3 多边形的示例

于 2013-10-26T15:03:25.243 回答