Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Hello OpenLayers

Public visualization

Hello OpenLayers

1 star1🌍 Public
CCurran Kelleher
Last edited Mar 4, 2020
Created on Mar 4, 2020
Forked from React Starter

This example shows a simple interactive map displaying a Stamen toner-lite basemap using OpenLayers within a React functional component. The Cartography component uses a useRef hook to create a map target and a useEffect hook to initialize an ol.Map instance with an ol.View centered on specified coordinates. The Basemap export defines an ol.layer.Tile layer with an ol.source.Stamen source. React’s state management stores the map and view objects, and cleanup calls map.setTarget(null) to free resources when the component unmounts.

AI-generated description

OpenLayers with React Starter code.

Comments

Sign in to join the discussion.

MIT Licensed