O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling clustered features

When working with lots of feature points, it is common to use the cluster strategy to avoid overlapping of points and improve the rendering performance.

In this recipe we are going to show how easy it is to style a vector layer using a cluster strategy:

Styling clustered features

Our layer vector will read a GeoJSON file with some cities of the world. The style will have the following characteristics:

  • For each cluster we will show the number of contained features
  • The point radius and border will depend on the number of contained features, the more features within it, the greater the radius will be

How to do it...

  1. Start adding the div element for the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required