Skip to content

useOlMap

useOlMap(): Map

Defined in: src/ol-map.tsx:81

Hook to access the OpenLayers Map instance from the nearest parent OlMap component. Must be used within a descendant of OlMap.

Map

The OpenLayers Map instance

If called outside of an OlMap component

function MapControl() {
const map = useOlMap()
// Use map instance
return <div>Map ready</div>
}