Case: Displaying massive number of objects on Google Maps

By | August 7, 2014

We continue set of articles about interesting technology areas and solutions we have implemented or encountered in our projects.
This article briefly describes our experience in development interesting component for multiple markers/objects on google maps in web application.

Huge Number of Google Map Marks

Our solution

For one of our projects we required to show more than 20,000 elements at the same time on google maps in web browsers. Objects coordinates are taken from our server-side service and we should have dynamic filtering of this data on client side. Straight-forward javascript approach with placing Google Maps API markers didn’t work well as the page worked extremely slow and that was unacceptable.

There are several approaches how to solve this problem:

  1. Grid-Based Clustering — it works by dividing the map into squares of a certain size (the size changes at each zoom) and then grouping the markers into each grid square.
  2. Distance-based clustering — it is similar to grid-based clustering, except instead of creating clusters of fixed square bounds, clusters are created based on the distance between the marker and a cluster centroid. Cluster centroids are generally specified algorithmically through iteration of the existing marker locations.
  3. Viewport marker management — restricting the markers rendered on the map into only those that exist within the viewable area.
  4. Server-side clustering — when client side of the Map knows only about groups of objects but not each object separately, e.g. using GeoHash.
  5. Server-side overlay — custom overlay that displays markers with minimal functionality. This approach may garner performance improvements over standard markers provided by the API.
  6. Platform specific solutions — Google Maps for Android already has Clustering API functions.

After reviewing and testing available solutions (see links below) and considering writing our own version, we have decided that Marker Clusterer, which implements client side grid based clustering, satisfies us the most at the moment.

Google Map Marks Solution

Interesting Challenges

  • We have found that any solution that is based on client-side rendering doesn’t work well with large number of markers (e.g. when approaching 10,000) and at later stages of the project we might switch to our own optimized version based on server side clustering/filtering similar to geohash.

Definitions

Geohash is a latitude/longitude geocode system invented by Gustavo Niemeyer when writing the web service at geohash.org, and put into the public domain. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape.

Links we find usefull

Don’t hesitate to contact us for consultation!

One thought on “Case: Displaying massive number of objects on Google Maps

  1. dan

    Have you looked at clustermash.com? they have been able to cluster at least 8 millions points of the GeoNames DB on one of their demo’s

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *