react-bkoi-gl
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-bkoi-gl | Docs

Description

react-bkoi-gl is a suite of React components designed to provide a API for Barikoi Maps. More information in the online documentation.

Installation

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

Example

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

Get Barikoi API key

To access Barikoi's API services, you need to:

  1. Register on Barikoi Developer Dashboard.
  2. Verify with your phone number.
  3. 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.

Learning Resources

License

This library is licensed under the MIT License. See the LICENSE file for details.

Support

For any issues or questions, please contact support@barikoi.com.

Package Sidebar

Install

npm i react-bkoi-gl

Weekly Downloads

370

Version

1.0.2

License

MIT

Unpacked Size

506 kB

Total Files

138

Last publish

Collaborators

  • barikoi