Book Image

OpenLayers 3.x Cookbook - Second Edition

By : Peter J. Langley, Antonio Santiago Perez
Book Image

OpenLayers 3.x Cookbook - Second Edition

By: Peter J. Langley, Antonio Santiago Perez

Overview of this book

OpenLayers 3 is one of the most important and complete open source JavaScript mapping libraries today. Throughout this book, you will go through recipes that expose various features of OpenLayers 3, allowing you to gain an insight into building complex GIS web applications. You will get to grips with the basics of creating a map with common functionality and quickly advance to more complicated solutions that address modern challenges. You will explore into maps, raster and vector layers, and styling in depth. This book also includes problem solving and how-to recipes for the most common and important tasks.
Table of Contents (14 chapters)
OpenLayers 3.x Cookbook Second Edition
About the Authors
About the Reviewer

Styling clustered features

When working with lots of feature points, it is common to use the cluster strategy to avoid the overlapping of points and improve the rendering performance. We've previously covered the clustering strategy in detail in the Using the cluster strategy recipe in Chapter 3, Working with Vector Layers, and although we introduced some custom styling in that recipe, we'll look at some more styling options to enhance the appearance of the clusters in this recipe.

We are going to load two separate GeoJSON files containing around 100 point geometries, each within a concentrated area, displaying the benefits of what a clustering strategy provides to this type of data. We will render these two sets of features on different layers, each layer with a unique style.

As an added extra, for one of the vector layers, we are going to include an icon of an arrow that points to a cluster with a high amount of points beneath it. You can see what we mean by viewing the following screenshot...