CedarMaps is the location data platform for mobile and web applications. We provide building blocks to add location features like maps, search, and navigation into any experience you create. Use our simple and powerful APIs & SDKs and our open source libraries for interactivity and control.
Not a CedarMaps user yet? Sign up for an account here. Once you’re signed in, all you need to start building is a CedarMaps access token.
This guide will take you through the process of integrating CedarMaps into your React application.
This package is a wrapper over react-mapbox-gl library.
Npm
npm install @cedarstudios/react-cedarmaps --save
Yarn
yarn add @cedarstudios/react-cedarmaps
import CedarMaps from '@cedarstudios/react-cedarmaps'
render() {
return {
<CedarMaps
containerStyle={{
height: '100vh',
width: '100%'
}}
token='YOUR ACCESS TOKEN'
center={[ 51.34379364705882, 35.74109568627451]}
>
</CedarMaps>
}
}
Get ReactMapboxGl
object and start adding Markers, Polylines or other controls.
const {RotationControl, ZoomControl, ScaleControl} = CedarMaps.getReactMapboxGl()
return (
<CedarMaps
containerStyle={{
height: '100vh',
width: '100%'
}}
token='YOUR ACCESS TOKEN'
preserveDrawingBuffer={false}
center={[ 51.34379364705882, 35.74109568627451]}
>
<RotationControl/>
<ZoomControl/>
<ScaleControl/>
</CedarMaps>
)
You can read more about ReactMapboxGl
in Mapbox Documentation
You can consult this example for getting acquainted with our package.