@geowiki/maplibre
A lightweight, MapLibre-only React wrapper used by the TanStack-based GeoWiki app.
Unlike @geowiki/map, this package has no Leaflet dependency and a much smaller
peer-dependency surface. It exposes a low-level MapContainer plus declarative
helpers (sources, layers, controls, base-layer presets) so consumers can compose
maps without touching the imperative MapLibre API directly.
Usage
import {
MapContainer,
GeoJsonSource,
ClusterLayer,
NavigationControl,
useBaseStyle,
} from "@geowiki/maplibre";
import "@geowiki/maplibre/styles.css";
function MyMap() {
const style = useBaseStyle("osm");
return (
<MapContainer style={style} center={[0, 0]} zoom={2} className="h-full w-full">
<NavigationControl position="top-right" />
<GeoJsonSource id="points" data={featureCollection} cluster />
<ClusterLayer sourceId="points" color="#00A7CE" />
</MapContainer>
);
}
Exports:
MapContainer – the React wrapper around maplibregl.Map
useMap – consume the current map instance inside descendants
GeoJsonSource, ClusterLayer, MarkerLayer – declarative source/layer primitives
NavigationControl, ScaleControl, AttributionControl – built-in MapLibre controls
useBaseStyle / BASE_STYLES – presets for OSM, satellite, terrain, hillshade