Fusion Table Layer with polygons AND markers

末鹿安然 提交于 2019-12-24 11:28:18

问题


Using Google Maps API v3

I have a map with the countries coloured using polygons from a Fusion Table Layer. When a polygon is clicked it opens the default Fusion Table info window which has been configured in the web interface.

Some of the countries can't be seen at certain zoom levels so I'd like these countries to have a polygon AND marker, which when clicked open the default Fusion Table info window. I did add a standard map marker but there is no way to open the Fusion Table info window when clicked.

I've read through the docs and looked at the examples but can't see how this is achieved. Is this possible?


回答1:


Managed to get this working.

I created a second Fusion Table layer and instead of selecting the KML column I selected the Longitude column with a WHERE clause specifying the smaller countries. This renders a layer with markers on the smaller countries which sits on top of the polygon layer.

The only downside is that both the polygon and marker are both clickable which could open duplicate default Fusion Table info windows. Not a major problem though.




回答2:


You can't access the "default FusionTables infowindow" from an external click event. You can query the FusionTable from your page and display an infowindow containing the same information on a click on a Google Maps API marker (or a sidebar entry).

Example (opening infowindow from sidebar click, not a marker, as you didn't provide an example)



来源:https://stackoverflow.com/questions/11650286/fusion-table-layer-with-polygons-and-markers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!