HeatmapLayer component visualizes the intensity and distribution of data points on a map using color gradients, making it easy to identify patterns and hotspots.
Import
The HeatmapLayer requires the
visualization library. Make sure to include it when loading the Google Maps API.Setup
Include thevisualization library in your API loader:
Usage
Props
data
- Type:
google.maps.MVCArray<google.maps.LatLng | google.maps.visualization.WeightedLocation> | google.maps.LatLng[] | google.maps.visualization.WeightedLocation[] - Required
LatLng objects or WeightedLocation objects for more control over point intensity.
options
- Type:
google.maps.visualization.HeatmapLayerOptions - Optional
onLoad
- Type:
(heatmapLayer: google.maps.visualization.HeatmapLayer) => void - Optional
onUnmount
- Type:
(heatmapLayer: google.maps.visualization.HeatmapLayer) => void - Optional
Use Cases
Crime Data Visualization
Display crime hotspots to help identify high-risk areas.Weighted Data Points
Use weighted locations to represent varying intensities or importance.Custom Gradient
Create custom color schemes to match your brand or data type.Dynamic Data Updates
Update heatmap data in real-time based on user interactions or filters.Common Options
radius
Controls the radius of influence for each data point in pixels.opacity
Sets the opacity of the heatmap layer (0 to 1).maxIntensity
Defines the maximum intensity value for the heatmap. Points with higher intensity will be clamped to this value.dissipating
Specifies whether heatmaps dissipate on zoom. When false, the radius of influence increases with zoom level.The heatmap automatically adjusts its visualization based on the zoom level to maintain optimal visual representation.
For optimal performance, consider limiting the number of data points. If you have thousands of points, consider aggregating nearby points or implementing data clustering.