1.0.19 • Published 3 years ago

@stcorp/leaflet-gl-canvas v1.0.19

Weekly downloads
-
License
0BSD
Repository
-
Last release
3 years ago

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]),
}

const options = {
    glLayerOptions: {
        points: data // or raster or bounds
    }
}
const leafletGlCanvas = new LeafletGlCanvas(options);
leafletGlCanvas.addTo(map);