Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to implement server side clustering and show it using OpenLayers. I am using this good material as an example. As a clustering result, a get some list of features, some of them are clusters. Like this (it is an output of previous example):

Array ( 
    [0] => Array ( 
        [0] => Array ( [id] => marker_3 [lat] => 59.431602 [lon] => 24.757563 ) 
        [1] => Array ( [id] => marker_4 [lat] => 59.437843 [lon] => 24.765759 ) 
        [2] => Array ( [id] => marker_6 [lat] => 59.434776 [lon] => 24.756681 ) 
    [1] => Array ( [id] => marker_5 [lat] => 59.439644 [lon] => 24.779041 ) 
    [2] => Array ( [id] => marker_2 [lat] => 59.432365 [lon] => 24.742992 ) 
    [3] => Array ( [id] => marker_1 [lat] => 59.441193 [lon] => 24.729494 ) 

where 0 element is cluster containing 3 features. But how can I compute this clusters geometry? Or how can I visualize it using OpenLayers?

share|improve this question
Any suggestions? – Bob Jan 25 '13 at 16:01

Is there a particular reason why you are doing it server-side? OpenLayers contains the ability to cluster vector features client-side. The benefit of doing it client-side is that OpenLayers will take care of the clustering for you as you zoom in and out of the map rather than you having to do it server-side. Clustering can be added to the vector layer using a strategy - more details here and an example here.

If there is a reason for doing it server-side then you could style the point feature (I'm assuming these are points) by applying a scale factor to the radius of the circle which could be based on the number of elements in the cluster. Decide on a base size for all your normal points, lets say 10px, and then add 2px for each additional point in the cluster. So, if you have a cluster of 10 points then you would make the size of the point denoting the cluster to be 30px - 10px + (10 * 2px).

To further distinguish them you could also add a label showing the number of points in the cluster.

The OpenLayers website contains lots of examples of styling features.

share|improve this answer

I ran into a similar problem and solved it with a combination of client-side clustering, server-side clustering and data-culling by viewport. You can find a detailed description in Mapping Large Data Sets.

share|improve this answer

Have to look at SaaS solutions, for example are able to cluster at least 8 million locations from the GeoNames DB on one of their demos?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.