Retrospective guide for @un-fao/visualization@0.1.0-review.0. Read Start here for matching dependencies and limitations.
This Deck layer displays one single-band raster. Its source union includes raster URLs, files/blobs and STAC Items. The example makes the URL's raster role explicit instead of asking the package to infer a document type.
import { DataViewport, SingleBandRasterLayer } from '@un-fao/visualization';
export function RasterExample({ url }: { url: string }) {
const layer = new SingleBandRasterLayer({
id: 'legacy-raster',
source: { type: 'raster-url', url },
displayMin: 0,
displayMax: 1,
});
return (
<div style={{ position: 'relative', width: '100%', height: 400 }}>
<DataViewport
initialViewState={{ longitude: 12.5, latitude: 41.9, zoom: 6 }}
controller={true}
layers={[layer]}
/>
</div>
);
}
| Module | Import | Purpose | Why or when |
|---|---|---|---|
@un-fao/visualization |
DataViewport |
Runtime-required | Hosts the layer in this standalone example. |
@un-fao/visualization |
SingleBandRasterLayer |
Runtime-required | Constructs the single-raster layer. |
Supply a browser-accessible raster URL and move the camera over its bounds.
The range 0..1 is illustrative, not a dataset default. displayMin and
displayMax override the display domain after STAC Raster scale/offset.
The props also offer assetKey, renderKey, sourceBaseUrl and hrefResolver
for STAC source selection/resolution, plus style, nodata, resampling and
request/cache controls. Optional inputs do not mean every source can render
without metadata or explicit configuration.
onSourceResolved, onLegendResolved and onLoad report results; they do not
create a legend widget or position this example's camera.
See SingleBandRasterLayer, SingleBandRasterLayerProps,
SingleBandRasterSourceInput and SingleBandRasterStyle.
Use the collection layer for a collection.