-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mapbox Cookbook
By :
As we already saw, creating markers and adding them to a map is not a difficult task at all. There are circumstances in which creating the markers one by one may work; however, what happens if the data we want to visualize has thousands of records?
Populating the map with large amounts of data is inefficient performance-wise, and the lag dominates the user experience. The user will not be able to distinguish the markers and have a clear picture of what is going on in this crowded map. Surely, this is a poor user experience.
In this recipe, you will learn how to use clustering to present data in a more efficient and clean way.
Perform the following steps:
Import the Leaflet.markercluster plugin.
Create a new featureLayer and add the data you want to use as features.
Once the data in the featureLayer is loaded, create a clusterGroup and add the features layer to it.
Perform the following steps:
Open the chapter-4-example6-starter...
Change the font size
Change margin width
Change background colour