@un-fao/visualization@0.1.0-review.1
    Preparing search index...

    DataViewport

    DataViewport is the standalone React surface for deck.gl layers from @un-fao/visualization. It owns no basemap and forwards its public props to deck.gl's DeckGL component, except that JSX children are not part of this package contract.

    Use this when you do not need a basemap. For a map-backed surface, use DataOverlay. Start here explains the component choices; DataViewport and DataViewportProps retain the complete API.

    Install the complete package peer set, including the map peers required by the shared root entry. No MapLibre component or direct MapLibre import is needed in this standalone example.

    Give the container non-zero dimensions and a positioning context so DeckGL's absolute wrapper remains inside it. Camera interaction is opt-in through controller; use either initial or controlled view state deliberately.

    import {
    DataViewport,
    type DataViewportProps,
    } from '@un-fao/visualization';

    const viewportProps = {
    layers: [],
    initialViewState: { longitude: 0, latitude: 0, zoom: 2 },
    controller: true,
    } satisfies DataViewportProps;

    export function StandaloneVisualization() {
    return (
    <div style={{ height: 480, position: 'relative', width: '100%' }}>
    <DataViewport {...viewportProps} />
    </div>
    );
    }
    Module Import Purpose Why or when
    @un-fao/visualization DataViewport Runtime-required Renders the package's standalone deck.gl viewport in this example.
    @un-fao/visualization DataViewportProps Optional type-only Checks the viewport prop object without adding runtime JavaScript.

    This standalone example requires no MapLibre map or direct MapLibre imports; the package's declared peer prerequisites still apply. layers: [] deliberately draws nothing. Replace it with a single-raster or collection layer to see data. Types and callbacks are not required to mount the surface.

    Prop Type Required? Default Ownership and effect
    layers LayersList Optional No package default Inherited from DeckGL. Supplies the ordered deck.gl layers rendered by the viewport.
    initialViewState TransitionProps | MapViewState | { [viewId: string]: TransitionProps; } | null Optional No package default Inherited from DeckGL. Seeds uncontrolled camera state and should not be combined casually with controlled viewState.
    viewState TransitionProps | MapViewState | { [viewId: string]: TransitionProps; } | null Optional No package default Inherited from DeckGL. Supplies controlled camera state that the consumer must update.
    controller boolean | ConstructorOf<Controller<any>> | (ControllerOptions & { type?: ConstructorOf<Controller<any>>; }) | null | undefined Optional No package default Inherited from DeckGL. Enables or configures deck.gl interaction; omitting it does not opt the package into interaction.
    onLoad () => void Optional No package default Inherited from DeckGL. Runs when the underlying Deck instance finishes initialization.
    onAfterRender (context: { device: Device; gl: WebGL2RenderingContext; }) => void Optional No package default Inherited from DeckGL. Observes completed render passes and must remain lightweight.

    All focused props are optional in the selected package declaration. “No package default” means DataViewport does not substitute a value; consult the exact DeckGL API for upstream behavior and defaults.

    If nothing appears, check container dimensions/positioning, that layers contains data, and that the camera covers its bounds. Set controller: true for interaction. If you pass controlled viewState, your application must update it in response to camera changes; a fixed value can make interaction appear stuck. Viewport onLoad means Deck initialized, not that every layer's data or tiles finished loading.

    Prop changes are forwarded through React. Unmount the component to release its Deck instance and GPU resources. Consumers own accessible controls, keyboard instructions, and non-canvas alternatives. Rendering correctness, Workers, shaders, and GPU cleanup remain covered by package tests rather than this static guide.