在FusionTablesLayer中应用查询后,是否可以遍历标记? [英] Possible to iterate through markers after applying a query in a FusionTablesLayer?

查看:44
本文介绍了在FusionTablesLayer中应用查询后,是否可以遍历标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个过滤器正在处理作为地图图层"呈现的融合表,并且我希望在每次更换过滤器时进行缩放以最适合所有数据.

I currently have a filter working on a fusion table rendered as a Map Layer, and I want to zoom to best fit all of the data whenever the filter is changed.

我认为我需要等到应用查询之后,然后遍历标记以找到最小/最大x& y位置并平移到该矩形,但是我在Maps api中看不到访问图层标记的方法.

I figure I need to wait until the query is applied and then iterate through the markers to find the min/max x & y locations and pan to that rectangle, but I don't see a way in the Maps api to access the markers of a layer.

任何人都知道如何执行此操作吗?

Anyone have an idea how to do this?

推荐答案

如果数据在融合表中,请使用融合表的sql api分别找到Lat和Lng的最大/最小值:

If your data is in a fusion table, then use the fusion table's sql api to find the Max/Min val for Lat and Lng respectively:

https://www.googleapis.com/fusiontables/v1/query?sql=SELECT  
MINIMUM(Lat) AS MinLat, MAXIMUM(Lat) AS MaxLat,
MINIMUM(Long) AS MinLong, MAXIMUM(Long) AS MaxLong
FROM <table_id>

有关API的完整详细信息,请参见此处: https://developers.google. com/fusiontables/docs/v1/sql-reference . (要记住的一件事是对该SQL语句进行ecodeURI)

See here for full details on api: https://developers.google.com/fusiontables/docs/v1/sql-reference. (One thing to remember is to ecodeURI this sql statement)

这会将那些值返回json数组.就像您确定的那样,请使用这些值设置地图的中心"和缩放"参数.

This returns those for value to json array. And as I'm sure your aware, use these values to set your map's 'center' and 'zoom' parameters.

这篇关于在FusionTablesLayer中应用查询后,是否可以遍历标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆