map-gl-compass-pro
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

map-gl-compass-pro npm npm downloads

New generation maps require new generation tools!

Screen

Example implementation

Usage

As for now map-gl-compass-pro works only with react & react-map-gl (react-map-gl is peer dependency). If community will express will of using it with raw mapbox / maplibre library I will add some wrapper around this component.

import MapGL from 'react-map-gl'
import maplibregl from 'maplibre-gl'
import CompassPro from 'map-gl-compass-pro'

function Map(){

  (...)

  return (
      <MapGL
        initialViewState={{
          longitude: 14.5580,
          latitude: 53.4441,
          zoom: 14
        }}
        mapLib={maplibregl}
        mapStyle="https://my-domain.com/mapStyle.json"
      >
        <CompassPro 
          mapId="myMap" // optional, default: current
          size="lg" // optional, one of  'xs' | 'sm' | 'md' | 'lg', default: 'md'
          visualizePitch={true} // optional, default false
          onNeedleClick={handleNeedleClick} // optional, default set pitch & bearing to 0 
          wrapperClass="ownClassName" // optional, default absolutely positioned in bottom left corner
        />
      (...)    
      </MapGL>
    );
}

Please make sure that Compass is child of MapGL, otherwise it won't work. Also read more about react-map-gl setup and mapId.

Package Sidebar

Install

npm i map-gl-compass-pro

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

12.5 kB

Total Files

12

Last publish

Collaborators

  • jedluk