Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deck.gl/mapbox

Package Overview
Dependencies
Maintainers
5
Versions
438
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deck.gl/mapbox

Use deck.gl layers as custom mapbox-gl-js layers

  • 9.0.35
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created

What is @deck.gl/mapbox?

@deck.gl/mapbox is a package that integrates Deck.gl visualizations with Mapbox GL maps. It allows you to create complex and performant visualizations on top of Mapbox maps, leveraging the power of Deck.gl's GPU-accelerated rendering.

What are @deck.gl/mapbox's main functionalities?

Integrate Deck.gl Layers with Mapbox

This feature allows you to add Deck.gl layers to a Mapbox map. The code sample demonstrates how to create a Mapbox map and add a Deck.gl ScatterplotLayer to it.

const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/light-v10',
  center: [-74.5, 40],
  zoom: 9
});

const deckLayer = new deck.MapboxLayer({
  id: 'my-deck-layer',
  type: deck.ScatterplotLayer,
  data: [{position: [-74.5, 40], size: 100}],
  getPosition: d => d.position,
  getRadius: d => d.size,
  getColor: [255, 0, 0]
});

map.on('load', () => {
  map.addLayer(deckLayer);
});

Synchronize Deck.gl Layers with Mapbox Camera

This feature ensures that Deck.gl layers stay in sync with the Mapbox camera. The code sample shows how to update the Deck.gl layer's view state whenever the Mapbox map is moved.

const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/light-v10',
  center: [-74.5, 40],
  zoom: 9
});

const deckLayer = new deck.MapboxLayer({
  id: 'my-deck-layer',
  type: deck.ScatterplotLayer,
  data: [{position: [-74.5, 40], size: 100}],
  getPosition: d => d.position,
  getRadius: d => d.size,
  getColor: [255, 0, 0]
});

map.on('load', () => {
  map.addLayer(deckLayer);
});

map.on('move', () => {
  deckLayer.setProps({
    viewState: {
      longitude: map.getCenter().lng,
      latitude: map.getCenter().lat,
      zoom: map.getZoom(),
      bearing: map.getBearing(),
      pitch: map.getPitch()
    }
  });
});

Other packages similar to @deck.gl/mapbox

Keywords

FAQs

Package last updated on 08 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc