CoralMap
CoralMap is the component used to display a base map, its custom data overlays, as well as its inner controls. It is a convenience wrapper around react-map-gl’s Map component , which is itself a React wrapper around Mapbox GL’s Map object . All of properties and methods are passed through to either react-map-gl or Mapbox GL.
Import
import { CoralMap, CoralMapGeolocateControl, CoralMapMarker } from '@krakentech/coral-maps';Basic usage
mapboxAccessToken is the only required prop. The default map is comprised of a default basemap (streets-satellite) and basic zoom controls.
<CoralMap mapboxAccessToken="..." />Adding overlays and controls as children
<CoralMap mapboxAccessToken="...">
{/* Custom control */}
<CoralMapGeolocateControl />
{/* Custom overlay */}
<CoralMapMarker feature={...} />
</CoralMap>Changing the basemap
<CoralMap mapboxAccessToken="..." basemap="satellite" />Setting the initial view state
<CoralMap mapboxAccessToken="..." initialViewStatePreset="JPN" />Full screen interaction mode
<CoralMap mapboxAccessToken="..." fullScreenInteraction={true} />Full API
| Name | Description | Default |
|---|---|---|
mapboxAccessToken | string | - |
basemap | Sets the visual appearance of the basemap.
| streets-satellite |
initialViewStatePreset | Sets the map’s initial latitude, longitude and zoom in order for a certain geography to be contained in the viewport. DEU ESP FRA GBR ITA JPN NZL USA | GBR |
fullScreenInteraction | Defines the behaviour of mouse-wheel interaction / single finger gestures. When set to false (default), the map is meant to be displayed whithin the normal vertical page scroll flow: it will not permit mouse-wheel/single finger interactions on the map to avoid hijacking page scroll, and will display navigation controls by default. When set to true, the map is meant to be used in a full screen / absolute positioned overlay: it will allow mouse-wheel/single finger interactions and navigation controls will be hidden by default.boolean | false |
Last updated on