All Implemented Interfaces:
Serializable, Evented, Identifiable, LayerPopupFunctions, LayerTooltipFunctions, ExecutableFunctions

@NpmPackage(value="leaflet.heat", version="0.2.0") @JsModule("leaflet.heat/dist/leaflet-heat.js") public class HeatLayer extends Layer

Leaflet.heat

A tiny, simple and fast Leaflet heatmap plugin. Uses leaflet.heat which uses simpleheat under the hood, additionally clustering points into a grid for performance.

Heatmap options

  • minOpacity - the minimum opacity the heat will start at
  • maxZoom - zoom level where the points reach maximum intensity (as intensity scales with zoom), equals maxZoom of the map by default
  • max - maximum point intensity, 1.0 by default
  • radius - radius of each "point" of the heatmap, 25 by default
  • blur - amount of blur, 15 by default
  • gradient - color gradient config, e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'}

Basic Usage

 HeatLayer heatLayer = new HeatLayer();
 heatLayer.setLatLngs(randomLatLngs());
 heatLayer.setOptions(new HeatLayerOptions());
 heatLayer.addTo(leafletMap);
 
Since:
2020-05-25
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Constructor Details

    • HeatLayer

      public HeatLayer()
      Constructs a heatmap layer
    • HeatLayer

      public HeatLayer(List<LatLng> latLngs)
      Constructs a heatmap layer given an array of points
      Parameters:
      latLngs - the initial points to be added
    • HeatLayer

      public HeatLayer(HeatLayerOptions options)
      Constructs a heatmap layer with custom layer options
      Parameters:
      options - the custom options to be used
      See Also:
    • HeatLayer

      public HeatLayer(List<LatLng> latLngs, HeatLayerOptions options)
      Constructs a heatmap layer given an array of points and an object with the following options
      Parameters:
      latLngs - the initial points to be added
      options - the custom options to be used
      See Also:
  • Method Details

    • addLatLng

      public void addLatLng(LatLng latLng)
      Adds a new point to the heatmap and redraws it.
      Parameters:
      latLng - a new point to be added
      See Also:
    • setLatLngs

      public void setLatLngs(List<LatLng> laLngs)
      Resets heatmap data and redraws it.
      Parameters:
      laLngs - the list of the new points to be added
      See Also:
    • setOptions

      public void setOptions(HeatLayerOptions options)
      Sets new heatmap options and redraws it.
      Parameters:
      options - the custom options to be used
    • redraw

      public void redraw()
      Redraws the heatmap.
    • getLatLngs

      public List<LatLng> getLatLngs()
      Returns the list of weighted points currently rendered by this heatmap.
      Returns:
      the heatmap points
      See Also:
    • getMinOpacity

      public double getMinOpacity()
      Returns the minimum opacity the heat will start at.
      Returns:
      the minimum opacity
    • getMaxZoom

      public int getMaxZoom()
      Returns the zoom level at which the points reach maximum intensity.
      Returns:
      the maximum zoom level
    • getMax

      public double getMax()
      Returns the maximum point intensity.
      Returns:
      the maximum point intensity
    • getRadius

      public double getRadius()
      Returns the radius of each point of the heatmap.
      Returns:
      the point radius
    • getBlur

      public double getBlur()
      Returns the amount of blur applied to the heatmap.
      Returns:
      the blur amount
    • getGradient

      public Map<Double,String> getGradient()
      Returns the color gradient configuration mapping intensity ratios to colors.
      Returns:
      the color gradient configuration