Binning is typically used to visualize the density of points in a layer. This sample demonstrates how to enable binning on a FeatureLayer with polyline geometries. Binning is configured in the featureReduction property of the layer and setting its type to binning
.
This example aggregates the locations of bridges along rail networks in New Zealand. Each bridge feature is represented as a polyline. When zoomed out, it isn't easy to perceive individual bridge locations and the overall density of bridges in an area. By enabling binning, the bridges are aggregated into bins, visualized as circles of varying sizes and colors. The color represents the rail line of the bridges in the bin, and the size represents the total length of bridges in the bin. You could alternatively visualize the total number of bridges using size.
Note that while bridges are clearly visible without binning enabled, the visualization misrepresents the data. For example, the image on the left portrays rail networks as if they are completely comprised of bridges, when in reality bridges make up a very small portion of the rail network. With binning enabled, as shown in the image on the right, the visualization appropriately represents bridges as clusters of individual entities within the rail network and communicates their density throughout the network.
Binning disabled | Binning enabled |
---|---|
When zoomed in, polyline features are more clearly visible in full fidelity.
For that reason, you should set a max
in the feature reduction configuration to disable binning at larger scales where individual features can be viewed at an appropriate level of detail.
Best practices for binning lines and polygons
When binning lines and polygons, the feature centroid is used for the aggregation. As a result, you should use the following guidelines when binning lines or polygons:
- Binning works best when features have a regular size smaller than the bin size.
- The density of irregularly shaped features may be misrepresented as some features may overlap several bins.
- Some features may be placed in bins that do not contain the majority of the feature.
- Some areas covered by large polygons or polylines may show no bins at all
- As a guideline, small features like parcels, buildings, swimming pools, bridges, culverts, or connectors are well-suited for binning at small scales.
- Large, irregularly shaped features like counties, states, or countries generally do not need to be aggregated.
- Binning works best at smaller scales (when zoomed out). You should set a
max
in the feature reduction configuration to disable binning at larger scales (when zoomed in) where features can be viewed in full fidelity.Scale
Related samples and resources
Binning
Learn how to aggregate features spatially using bins.
Binning with aggregate fields
This sample demonstrates how to define aggregate fields that can be used in the popup, labels, and renderer of a binned layer.
Binning - Filter by category
Demonstrates how to filter binned data by category.
Summarize binned data using Arcade
Use Arcade in popups to summarize binned crimes by type
Intro to clustering
Intro to clustering
FeatureReductionBinning
Read the Core API Reference for more information.