Cluster Cluster - Fusion Table Layer - Google Maps v3

Is there a way to get marker clusters (i.e. makerclusterer ) to work with a Fusion table layer? It seems like you should assign markerclusterer markers, but when using the merge table layer, does Google handle markers / infowindows? Still trying to figure out what the merger table is.

Basically looking for a way to group a large number of tokens provided through a Fusion table

+6
source share
4 answers

Fusion tables allow you to simultaneously view thousands of points using server-side rendering (from google servers). Marker Clusterer solves the problem by creating a set of clusters from the nearest points (from the client browser). I will not use them at the same time, but this may work for your use.

You can learn more about how they work here:

http://code.google.com/apis/maps/articles/toomanymarkers.html

If you really wanted to, you could use the Fusion table APIs to feed data from Fusion tables to the marker cluster.

Hope this helps.

0
source

Fusion layer tables display an additional png image for each tile that is superimposed on top of a map tile containing data points for that tile, this is part of the server-side rendering. Thus, these are several data points per fragment containing data points.

MapsIt.png map tile with data points already positioned on the layer

Creating your own markers from the data necessary for MarkerClusterer does not superimpose the image on one fragment, it creates an individual marker on the map for each data point and superimposes the sprite image on it.

Marker Sprite image used for each data point

Based on this, you cannot use MarkerClusterer and FusionTablesLayer.

+5
source

This is my own code. I tried to use the technique in an earlier link, but this did not work for me. So this is how I did it.

First I requested a merge table with a regular query api chart

function initialize() { mapMain = new google.maps.Map(document.getElementById('map-canvas'), { center: new google.maps.LatLng(37.4, -100.1), zoom: 3, mapTypeId: google.maps.MapTypeId.ROADMAP }); mc = new MarkerClusterer(mapMain); var queryText = encodeURIComponent("select wikipedia_article, xy from "+tableid); var query = new google.visualization.Query("https://www.google.com/fusiontables/gvizdata?tq="+queryText); query.send(handleQueryResponse); } 

Then, in my handleQueryResponse, I dynamically created markers and added it to Mapclusterer

 function handleQueryResponse(response){ dataTable = response.getDataTable(); for(var i=0; i< dataTable.getNumberOfRows();i++){ var hrefval = dataTable.getValue(i,0).toString(); var arr = dataTable.getValue(i,1).toString().split(" "); var latlng = new google.maps.LatLng(arr[0], arr[1]); var marker = new google.maps.Marker({ position: latlng, map:mapMain }); fn = markerClick(i, marker); google.maps.event.addListener(marker,'click', fn); markers.push(marker); } mc.addMarkers(markers); } 

In this case, the main map, an array of markers (mc in the code below), are global variables. You can see the full working example here .

+5
source

I do not think that you will work with the merge table. IMO in the merge table lacks spatial index support. Si helps reduce complexity 2d to complexity 1d. It is used in many applications, such as heat maps, treemaps, post-processing search, maps application. You want to look at the quadrant blog with Nick Hilbert critical index.

+1
source

Source: https://habr.com/ru/post/893626/


All Articles