1.0.0 • Published 6 years ago

leaflet-smooth-heatmap v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Leaflet Smooth Heatmap

Serverless smooth and unbroken heatmap tile layer.

Live Demo

Description

Canvas tile layer. Each tile filled with grid of rectangles. Rectangle color requested by coordinates of it center.

Not intended for use on low-performance devices.

Installation

  1. Install with npm
npm install leaflet-smooth-heatmap
  1. Import JS dependencies
import { SmoothHeatmapLayer } from 'leaflet-smooth-heatmap';

or include src/index.js to your bundle and use plugin through global L variable

Usage

const options = {
  canvasSize: 5,
  getColorForLatLng: (lat, lng) => `rgba(${90 + lat}, ${180 + lng}, 100, .5)`
};
map.addLayer( new SmoothHeatmapLayer(options)) );

Example with data point interpolation in ./docs

Options

NameDescriptionTypeDefault
canvasSizeSize of rectangles in canvas (low values influence on performance)Number3
getColorForLatLngReturn color for point coordinates. Arguments - lat, lngFunctionfunction() { return 'rgba(0, 0, 0, 0);' }