🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@deck.gl-community/leaflet

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deck.gl-community/leaflet

deck.gl integration with Leaflet

latest
Source
npmnpm
Version
9.2.0-beta.3
Version published
Maintainers
5
Created
Source

@deck.gl-community/leaflet

This module allows Leaflet to be used as a deck.gl basemap.

More precisely, it provides a Leaflet custom layer that wraps a deck.gl renderer, enabling deck.gl to render layers synchronized with the Leaflet basemap.

Installation

npm install deck.gl @deck.gl-community/leaflet leaflet

Usage

import {DeckLayer} from '@deck.gl-community/leaflet';
import {MapView} from '@deck.gl/core';
import {GeoJsonLayer, ArcLayer} from '@deck.gl/layers';
import * as L from 'leaflet';
import 'leaflet/dist/leaflet.css';

// source: Natural Earth http://www.naturalearthdata.com/ via geojson.xyz
const AIR_PORTS =
  'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_airports.geojson';

// Create map
const map = L.map(document.getElementById('map'), {
  center: [51.47, 0.45],
  zoom: 4,
});
L.tileLayer('https://tiles.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}@2x.png', {
  maxZoom: 22,
  attribution:
    'Š <a href="https://carto.com/about-carto/" target="_blank" rel="noopener">CARTO</a>, Š <a href="http://www.openstreetmap.org/about/" target="_blank">OpenStreetMap</a> contributors',
}).addTo(map);

// Add deck.gl overlay
const deckLayer = new DeckLayer({
  views: [
    new MapView({ repeat: true }),
  ],
  layers: [
    new GeoJsonLayer({
      id: 'airports',
      data: AIR_PORTS,
      // Styles
      filled: true,
      pointRadiusMinPixels: 2,
      pointRadiusScale: 2000,
      getPointRadius: (f) => 11 - f.properties.scalerank,
      getFillColor: [200, 0, 80, 180],
      // Interactive props
      pickable: true,
      autoHighlight: true,
      onClick: (info) =>
        // eslint-disable-next-line
        info.object && alert(`${info.object.properties.name} (${info.object.properties.abbrev})`)
    }),
    new ArcLayer({
      id: 'arcs',
      data: AIR_PORTS,
      dataTransform: (d: any) => d.features.filter((f) => f.properties.scalerank < 4),
      // Styles
      getSourcePosition: (f) => [-0.4531566, 51.4709959], // London
      getTargetPosition: (f) => f.geometry.coordinates,
      getSourceColor: [0, 128, 200],
      getTargetColor: [200, 0, 80],
      getWidth: 1
    })
  ],
  getTooltip: (info) => info.object && info.object.properties.name
});
map.addLayer(deckLayer);

API Reference

DeckLayer

An implementation of L.Layer.

const deckLayer = new DeckLayer({
  views: [
    new MapView({ repeat: true }),
  ],
  layers: [...],
});
map.addLayer(deckLayer);

The constructor accepts a props object that is passed to the Deck constructor. See the limitations section below for more details.

The following Deck methods can be called directly from a DeckLayer instance:

  • deckLayer.setProps
  • deckLayer.pickObject
  • deckLayer.pickMultipleObjects
  • deckLayer.pickObjects

Supported Features and Limitations

Supported deck.gl features:

  • Layers
  • Effects
  • Auto-highlighting
  • Attribute transitions
  • onHover and onClick callbacks
  • Tooltip

Not supported features:

  • Tilting
  • Multiple views
  • Controller
  • React integration
  • Gesture event callbacks (e.g. onDrag*)

Keywords

webgl

FAQs

Package last updated on 17 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts