Retrospective guide for @un-fao/visualization@0.1.0-review.0. Read Start here for matching dependencies and limitations.
DataOverlay mounts a Deck MapboxOverlay through the MapLibre wrapper's
useControl and updates its props. Place it inside a react-map-gl/maplibre
map. The parent owns the map and camera; the overlay renders no React element.
import maplibregl from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import { Map } from 'react-map-gl/maplibre';
import { DataOverlay } from '@un-fao/visualization';
export function OverlayExample() {
return (
<Map
mapLib={maplibregl}
initialViewState={{ longitude: 12.5, latitude: 41.9, zoom: 6 }}
mapStyle={{ version: 8, sources: {}, layers: [] }}
style={{ width: '100%', height: 400 }}
>
<DataOverlay layers={[]} />
</Map>
);
}
| Module | Import | Purpose | Why or when |
|---|---|---|---|
maplibre-gl |
default as maplibregl |
Runtime-required | Supplies the engine to the raw map wrapper. |
maplibre-gl/dist/maplibre-gl.css |
side effect |
Runtime-required | Styles the raw MapLibre map in this example. |
react-map-gl/maplibre |
Map |
Runtime-required | Provides the parent map/control context. |
@un-fao/visualization |
DataOverlay |
Runtime-required | Attaches the Deck overlay to that map. |
The empty style and layer list show the wiring without a remote basemap. Supply your own style and layers to render data.
DataOverlayProps excludes interleaved, camera/controller, canvas/device,
parent and views inputs. Do not configure a second camera on the overlay.
See DataOverlay and DataOverlayProps for the exact allowed inputs.