Follow

Create a Cluster layer

When you have a Layer with many geometries overlapping together on the map on higher zoom level, you will probably find useful to create a Cluster Layer.  A Cluster layer is a cartographic visualization option that let you group point geometry based on their localization.

 cluster_layer.gif

Cluster configuration options

You must define the cluster configuration. For this you have 4 options to define what will be the aggregating parameters of your clustered layer.  The most important parameter of clustoring is MAXDISTANCE, that allows you to define the area of the aggregation.  See official documentation for more information about this topic:

CLUSTER
      MAXDISTANCE 20 # in pixels
      REGION "ellipse" # can be rectangle or ellipse 
      GROUP (expression) # an expression to create separate groups for each value
      FILTER (expression) # a logical expression to specify the grouping condition
END

Add a first clustered classes

When you create a Cluster Layer, you have access to special keyword Cluster_FeatureCount and Cluster_Group that will allows you to manage the way you will print out cluster classes.  The Cluster_FeatureCount keyword will be useful to configure your layer with TEXT and EXPRESSION tag option:

CLASS
      EXPRESSION ([Cluster_FeatureCount] > 1)
      NAME 'More then 1'
      STYLE
           ...
      END
      LABEL
          TEXT "[Cluster_FeatureCount]"
          ...
      END
END

Add more classes

One of the most powerfull tool of the mapfile snippet feature is the flexibility. You can add as much as classes you need to enhance your cluster layer. Read articles about Fonts and Symbols Library for more customization. Here's the complete Mapfile Snippet of this example.

Template snippet

Here's a complete example of a clustered map layer:  

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk