PredefinedOverlay
Live traffic cameras, road events and air quality from Sphere
<PredefinedOverlay> shows one of Sphere's live data overlays while it's mounted.
Live data from Sphere. Some overlays can be empty at times.
import { PredefinedOverlay, SphereMap } from "gistda-sphere-react";
<SphereMap>
<PredefinedOverlay type="cameras" />
<PredefinedOverlay type="events" refresh={60} />
<PredefinedOverlay type="aqi" />
</SphereMap>| Type | Shows |
|---|---|
"cameras" | Traffic cameras (CCTV), with live video where available. |
"events" | Road events such as accidents and roadworks. Refreshes every 3 minutes by default. |
"aqi" | Air quality index stations. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | "cameras" | "events" | "aqi" | required | Which overlay to show. |
popup | boolean | true | Open a popup when an item is clicked. |
motion | boolean | true | Cameras only: include cameras with live video. |
refresh | number | – | Reload the data every this many seconds. |
Each predefined overlay exists once per page in the Sphere API, so don't show the same type on two maps at the same time.
onOverlayLoad on SphereMap fires whenever the data (re)loads. You can also load these overlays imperatively with useMapControls().loadPredefinedOverlay.