react-bkoi-gl | Docs
react-bkoi-gl
is a suite of React components designed to provide a API for Barikoi Maps. More information in the online documentation.
Using react-bkoi-gl
requires react >= 16.3
.
To install the package via npm, run the following command:
npm install react-bkoi-gl
Or via yarn:
yarn add react-bkoi-gl
import { useRef } from 'react';
import { Map, FullscreenControl, GeolocateControl, NavigationControl, ScaleControl } from 'react-bkoi-gl';
// Import Styles
import "react-bkoi-gl/styles"
const App = () => {
const BARIKOI_API_KEY = 'YOUR_BARIKOI_API_KEY_HERE'
const mapStyle = `https://map.barikoi.com/styles/osm-liberty/style.json?key=${BARIKOI_API_KEY}`
const mapContainer = useRef(null);
const mapRef = useRef(null);
const initialViewState = {
longitude: 90.36402,
latitude: 23.823731,
minZoom: 4,
maxZoom: 30,
zoom: 13,
bearing: 0,
pitch: 0,
antialias: true
}
return (
<div
ref={mapContainer} style={containerStyles}
>
<Map
ref={mapRef}
mapStyle={mapStyle}
style={{ width: "100%", height: "100%" }}
initialViewState={initialViewState}
doubleClickZoom={false}
dragRotate={false}
attributionControl={false}
>
<GeolocateControl position="top-right" />
<FullscreenControl position="top-right" />
<NavigationControl position="top-right" />
<ScaleControl position="bottom-right" />
</Map>
</div>
)
}
// JSX Styles
const containerStyles = {
width: "100%",
height: "100vh",
minHeight: "400px",
overflow: "hidden",
}
export default App
To access Barikoi's API services, you need to:
- Register on Barikoi Developer Dashboard.
- Verify with your phone number.
- Claim your API key.
Once registered, you'll be able to access the full suite of Barikoi API services. If you exceed the free usage limits, you'll need to subscribe to a paid plan.
This library is licensed under the MIT License. See the LICENSE file for details.
For any issues or questions, please contact support@barikoi.com.