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)

ComponentDescription
VLayerDeckglScatterplotCircles/points at geographic positions
VLayerDeckglArcArcs between origin-destination pairs
VLayerDeckglLineFlat lines between points
VLayerDeckglPathPolylines/routes with width
VLayerDeckglPolygonFilled/stroked polygons
VLayerDeckglSolidPolygonExtruded 3D polygons
VLayerDeckglGeojsonGeoJSON features with styling
VLayerDeckglIconIcons/markers at positions
VLayerDeckglTextText labels
VLayerDeckglColumn3D columns/cylinders
VLayerDeckglBitmapGeoreferenced images
VLayerDeckglGridCellGrid cells with elevation
VLayerDeckglPointCloud3D point clouds

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

ComponentDescription
VLayerDeckglHeatmapDensity heatmap visualization
VLayerDeckglHexagonHexagonal binning with elevation
VLayerDeckglGridSquare grid aggregation
VLayerDeckglContourContour/isoline visualization
VLayerDeckglScreenGridScreen-space grid (fixed pixel size)

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

ComponentDescription
VLayerDeckglTripsAnimated path visualization
VLayerDeckglMVTMapbox Vector Tiles
VLayerDeckglTileGeneric tile layer
VLayerDeckglTile3D3D Tiles (Cesium format)
VLayerDeckglTerrainTerrain mesh from elevation data
VLayerDeckglH3HexagonH3 hexagonal cells
VLayerDeckglH3ClusterH3 hexagon clusters
VLayerDeckglGreatCircleGreat circle arcs
VLayerDeckglS2S2 geometry cells
VLayerDeckglGeohashGeohash grid cells
VLayerDeckglQuadkeyQuadkey tile cells
VLayerDeckglWMSWMS tile service

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

ComponentDescription
VLayerDeckglSimpleMesh3D mesh objects
VLayerDeckglScenegraphglTF/GLB 3D models

Generic Layer

ComponentDescription
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';