Clustering millon markers?

1,765 views
Skip to first unread message

NakiO

unread,
Aug 4, 2010, 7:47:54 AM8/4/10
to Google Maps JavaScript API v3
Hello, first of all sorry for my English..

I'm developing a map with millons of markers and I readed about Marker
clusterer of the Api V3 but I see that the markers are loaded (not
shown but preloaded) and if I have a millon of markers the maps takes
too long time..

So I need to get the focused LatLong (that I can do it) and so get
markers according to the focused zone..
My problem is that if I load 1000 markers and next I drag the map, the
only solution I get in mind is to clear all markers and redraw them..
and when I move the map a few metters I have the same operation over
and over.. clear and redraw tasting a lot of bandwith..

Do you know any way to clear only markers that are not on a ratio of
seen (focused) zone with gmap api javascript or PHP ?..

Thanks a lot to all!

Rossko

unread,
Aug 4, 2010, 5:44:25 PM8/4/10
to Google Maps JavaScript API v3
"thousands of markers" gets discussed quite regularly, if you search
this group
Example
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/59a52aecec860e75/eaa2891a668357b7

"millions" is another proposition ; I think you will almost certainly
have to go via the server-side tile generation route simply to avoid
multi-Mb data transfers at wider zoom levels.

Federico Ulfo

unread,
Aug 4, 2010, 7:28:34 PM8/4/10
to google-map...@googlegroups.com
here it is http://googlegeodevelopers.blogspot.com/2009/04/markerclusterer-solution-to-too-many.html

2010/8/4 Rossko <ros...@culzean.clara.co.uk>

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Luke Mahé

unread,
Aug 4, 2010, 8:06:08 PM8/4/10
to google-map...@googlegroups.com
NakiO,

This is just off the top of my head and I haven't looked into it but you could do something like this:

/**
 * @constructor
 * @param {google.maps.LatLng} position
 */
function FakeMarker(position) {
  this.position = position;
}

FakeMarker.prototype.setMap = function(opt_map) {};
FakeMarker.prototype.setVisible = function(opt_visible) {};

/**
 * @return {google.maps.LatLng}
 */
FakeMarker.prototype.getPosition = function() {
  return this.position;
};

And then pass an array of FakeMarkers to the MarkerClusterer. What will not work is if there is only 1 marker in a cluster because it has nothing to show but its up to you then what you want to do :)

- Luke

AlbertoHN

unread,
Jul 13, 2011, 5:09:39 PM7/13/11
to google-map...@googlegroups.com
Theres is a way to draw thousands of markers using custom overlays. I'v done it already, but the problem is that I can't use the info windows attached to them.
 
These are aproximated times I have achieved with this approach:
 
Markers - Time
1000 - 5s
5000 - 15s
10000 - 41s
17000 - 2:17
25000 - 4:29
 
Do you know how can I create thousands of infowindows, polygons and polylines?
 
 

Javo Rosales

unread,
Jul 13, 2011, 5:25:05 PM7/13/11
to google-map...@googlegroups.com
Cluster markers + fusion tables?

2011/7/13 AlbertoHN <alberto.hd...@gmail.com>
 

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.

Barry Hunter

unread,
Jul 13, 2011, 5:32:59 PM7/13/11
to google-map...@googlegroups.com
Fusion tables 'only' copes with 100,000 features.

Although the approach to 'infowindows' that I believe the FT layers
use, is capture the 'click' then send the coordinates back to the
server 'ajax' style, and see if anything is at that point.

... that way you avoid having lots of data client-side. Only just
enough to show what is currently visible.

Javo Rosales

unread,
Jul 13, 2011, 5:39:41 PM7/13/11
to google-map...@googlegroups.com
At least it was near to 1M XD

2011/7/13 Barry Hunter <barryb...@gmail.com>

DropaBalm.com Jambo

unread,
Jul 14, 2011, 6:29:26 PM7/14/11
to Google Maps JavaScript API v3
I don't at all mean to sound cheeky or glib (or discouraging) but it
would certainly seem that your own prototyping tests suggest that you
simply have not thought deeply enough about your application design,
especially a user's need to amount of information at any one time.

Client-side JavaScript processing (especially AJAX interactions post-
initial page server) seem to be needed to provide an interactive drill-
down with your user that would result in loading just-enough, just-in-
time information for display.

Chris Broadfoot

unread,
Jul 14, 2011, 10:23:34 PM7/14/11
to google-map...@googlegroups.com
On Thu, Jul 14, 2011 at 7:09 AM, AlbertoHN <alberto.hd...@gmail.com> wrote:
the problem is that I can't use the info windows attached to them.

How can the user click on a specific marker, when there are a million of them? I would first re-evaluate this user experience, then think about sending the location of any clicks to your server, to then send back relevant information to show in an info window.

--

Reply all
Reply to author
Forward
0 new messages