Possible to iterate through markers after applying a query in a FusionTablesLayer?

后端 未结 2 2007
离开以前
离开以前 2020-11-29 13:08

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.

I figure

2条回答
  •  独厮守ぢ
    2020-11-29 13:39

    The short answer is no. To me this is one of the shortcomings of dealing with Fusion Tables via the Maps API. E.g. wanting to display a count of the results of my most recent query. But there is a work-around through the "undocumented" JSONP API to Fusion Tables. I've had great success using it but I must credit Robin Kraft with informing me about this API. http://www.reddmetrics.com/2011/08/10/fusion-tables-javascript-query-maps.html.

    Here's some code which allows you to re-execute your most recent query via an AJAX JSONP request and do what you want with the results, such as calculating the bounding-box. Note: this example uses Jquery for the AJAX JSONP calls. This example creates a

    display but can be modified as needed.

     
    
    // Example call
    getFTData(tableid, 'latitude,longitude', example_dataHandler);
    
    
    

    Since retrieving the count of recent Fusion Table rows returned is common, I'm adding a snippet of how to do that.

    
    
    
    

    提交回复
    热议问题