1.0.15 • Published 2 years ago
leaflet-gl-canvas v1.0.15
A plugin for visualizing large amounts of data on a GL-overlay on top of Leaflet
About
This plugin can be used to visualize large amounts of data on top of a Leaflet-map. Supports points, rasterized data, and triangles.
Installation
npm install leaflet-gl-canvas
Usage
// Import leaflet
import 'leaflet/dist/leaflet.css';
import * as L from 'leaflet';
// Import plugin
const { LeafletGlCanvas } = require('leaflet-gl-canvas');
// Create a leaflet-map
const map = L.map('map')
.setView([50.00, 14.44], 0);
// Currently requires values and a supplied colormap in the format [[r, g, b], [r, g, b], [r, g, b]...]
// R, G and B each being a value between 0 and 1
const data = {
latitudes: [1.0, 2.0, 3.0],
longitudes: [-3.0, 2.0, 5.0],
values: [255, 255, 255],
colorMap: [...Array(256).keys()].map(item => [item/256, item/256, item/256]),
type: 'points' // or raster or bounds
}
const leafletGlCanvas = new LeafletGlCanvas(map, data, {
drawingMode: 'points' // or triangles
})