This guide was added retrospectively for @un-fao/map@0.1.0-review.0. It describes the published npm archive, not original release-tagged docs or the current Map package. API pages are generated from that archive's declarations.
This version wraps MapLibre through react-map-gl/maplibre, not the newer
MapTiler SDK integration. The archive's README records this tested consumer
tuple; its declared peer ranges are broader:
npm install @un-fao/map@0.1.0-review.0 maplibre-gl@5.21.1 \
react@19.2.4 react-dom@19.2.4 react-map-gl@8.1.0
Use a browser React application and a sized container. The package entry imports MapLibre CSS; do not import it again for this setup.
import { MapViewport, defaultMapStyle } from '@un-fao/map';
export function MapExample() {
return (
<div style={{ position: 'relative', width: '100%', height: 400 }}>
<MapViewport
initialViewState={{ longitude: 12.5, latitude: 41.9, zoom: 6 }}
mapStyle={defaultMapStyle}
style={{ width: '100%', height: '100%' }}
/>
</div>
);
}
| Module | Import | Purpose | Why or when |
|---|---|---|---|
@un-fao/map |
MapViewport |
Runtime-required | Renders the map in this example. |
@un-fao/map |
defaultMapStyle |
Runtime-required | Supplies this example's explicit style; omit the import if you omit or replace that prop. |
| Input | Required? | Default / behavior in this release |
|---|---|---|
mapStyle |
No | Defaults to the exported CARTO Dark Matter style URL; its resources need network access. |
initialViewState |
No | Passed through; the example supplies its own starting camera. |
style |
No | Passed through; the example explicitly fills its sized parent. |
showBasemap3dBuildings |
No | Defaults to false; targets compatible CARTO building layers and does not extrude them in globe projection. |
ref |
No | Forwards the map wrapper ref, typed as MapViewportRef. |
Other inputs come from MapProps except mapLib, which this component owns.
See MapViewport, MapViewportProps, MapViewportRef and
defaultMapStyle. This version does not export MapControls,
BasemapControl or createMapTilerBasemaps.
Sources: this archive's README, manifest, dist/index.d.ts,
dist/MapViewport.d.ts and dist/index.js. The example is typechecked against
the exact archive. This is not a new browser/runtime certification: the shipped
README limits its verified consumer claim to browser ESM, its recorded npm/Vite
setup and Bundler-mode TypeScript with skipLibCheck. Remote provider
availability is not tested here.