Layers

Deck.gl Layers

High-performance WebGL visualization layers powered by deck.gl

Overview

v-maplibre provides Vue 3 components for all major deck.gl layer types. These layers render on a separate WebGL canvas (overlaid mode) for optimal performance and easier debugging.

Installation

Install the required deck.gl packages alongside v-maplibre:

pnpm add @geoql/v-maplibre @deck.gl/core @deck.gl/layers @deck.gl/mapbox

For additional layer types, install the corresponding packages:

pnpm add @deck.gl/aggregation-layers  # Heatmap, Hexagon, Grid, etc.
pnpm add @deck.gl/geo-layers          # Trips, MVT, Tile, H3, etc.
pnpm add @deck.gl/mesh-layers         # SimpleMesh, Scenegraph

Basic Usage

<script setup lang="ts">
  import { VMap, VLayerDeckglScatterplot } from '@geoql/v-maplibre';

  const mapOptions = {
    style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
    center: [-122.4, 37.8],
    zoom: 11,
  };

  const data = [
    { coordinates: [-122.4, 37.8], size: 100 },
    { coordinates: [-122.5, 37.7], size: 200 },
  ];
</script>

<template>
  <VMap :options="mapOptions" style="height: 500px">
    <VLayerDeckglScatterplot
      id="scatterplot"
      :data="data"
      :get-position="(d) => d.coordinates"
      :get-radius="(d) => d.size"
      :get-fill-color="[255, 140, 0]"
      :radius-min-pixels="5"
      :pickable="true"
      @click="(info) => console.log('Clicked:', info.object)"
    />
  </VMap>
</template>

Available Layers

Core Layers (@deck.gl/layers)

ComponentDescriptionExample
VLayerDeckglScatterplotCircles/points at geographic positionsDemo
VLayerDeckglArcArcs between origin-destination pairsDemo
VLayerDeckglLineFlat lines between pointsDemo
VLayerDeckglPathPolylines/routes with widthDemo
VLayerDeckglPolygonFilled/stroked polygonsDemo
VLayerDeckglSolidPolygonExtruded 3D polygonsDemo
VLayerDeckglGeojsonGeoJSON features with stylingDemo
VLayerDeckglIconIcons/markers at positionsDemo
VLayerDeckglTextText labelsDemo
VLayerDeckglColumn3D columns/cylindersDemo
VLayerDeckglBitmapGeoreferenced imagesDemo
VLayerDeckglGridCellGrid cells with elevationDemo
VLayerDeckglPointCloud3D point cloudsDemo

Aggregation Layers (@deck.gl/aggregation-layers)

ComponentDescriptionExample
VLayerDeckglHeatmapDensity heatmap visualizationDemo
VLayerDeckglHexagonHexagonal binning with elevationDemo
VLayerDeckglGridSquare grid aggregationDemo
VLayerDeckglContourContour/isoline visualizationDemo
VLayerDeckglScreenGridScreen-space grid (fixed pixel size)Demo

Geo Layers (@deck.gl/geo-layers)

ComponentDescriptionExample
VLayerDeckglTripsAnimated path visualizationDemo
VLayerDeckglMVTMapbox Vector TilesDemo
VLayerDeckglTileGeneric tile layerDemo
VLayerDeckglTile3D3D Tiles (Cesium format)-
VLayerDeckglTerrainTerrain mesh from elevation dataDemo
VLayerDeckglH3HexagonH3 hexagonal cellsDemo
VLayerDeckglH3ClusterH3 hexagon clustersDemo
VLayerDeckglGreatCircleGreat circle arcsDemo
VLayerDeckglS2S2 geometry cellsDemo
VLayerDeckglGeohashGeohash grid cellsDemo
VLayerDeckglQuadkeyQuadkey tile cellsDemo
VLayerDeckglWMSWMS tile serviceDemo

Mesh Layers (@deck.gl/mesh-layers)

ComponentDescriptionExample
VLayerDeckglSimpleMesh3D mesh objectsDemo
VLayerDeckglScenegraphglTF/GLB 3D modelsDemo

Raster Layers (@developmentseed/deck.gl-raster)

ComponentDescriptionExample
VLayerDeckglCOGCloud-Optimized GeoTIFF (GPU-accelerated)Demo

Generic Layer

ComponentDescriptionExample
VLayerDeckglGeneric wrapper for any deck.gl layer-

Common Props

All deck.gl layer components share these common props:

PropTypeDefaultDescription
idstringrequiredUnique layer identifier
dataarray | string | PromiserequiredData source
visiblebooleantrueLayer visibility
opacitynumber1Layer opacity (0-1)
pickablebooleantrueEnable picking/interaction
autoHighlightbooleanfalseHighlight on hover
highlightColorColor-Highlight color
beforeIdstring-MapLibre layer to insert before

Events

All layers emit these events when pickable is enabled:

EventPayloadDescription
@clickPickingInfoClicked on a feature
@hoverPickingInfoHovering over a feature
<VLayerDeckglScatterplot
  :pickable="true"
  @click="handleClick"
  @hover="handleHover"
/>

Accessors

Many props accept accessor functions for data-driven styling:

<VLayerDeckglScatterplot
  :data="data"
  :get-position="(d) => d.coordinates"
  :get-radius="(d) => d.population / 1000"
  :get-fill-color="(d) => d.risk > 0.5 ? [255, 0, 0] : [0, 255, 0]"
/>

TypeScript

Import types from deck.gl packages:

import type { Color, PickingInfo, Position } from '@deck.gl/core';