@geowiki/maplibre
v0.0.0
Published
A lightweight, MapLibre-only React wrapper used by the TanStack-based GeoWiki app.
Downloads
71
Readme
@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 aroundmaplibregl.MapuseMap– consume the current map instance inside descendantsGeoJsonSource,ClusterLayer,MarkerLayer– declarative source/layer primitivesNavigationControl,ScaleControl,AttributionControl– built-in MapLibre controlsuseBaseStyle/BASE_STYLES– presets for OSM, satellite, terrain, hillshade
