0.4.1 • Published 2 years ago

map-gl-geolocation v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

MapGL Geolocation Plugin

A mapbox-gl-js plugin to enable custom geolocation providers.

The project should works with maplibre-gl-js too.

Screenshot

Note: This is a work in progress and we welcome contributions.

Usage

import { Map } from 'mapbox-gl';
import { addGeolocationTo, GeolocationControl } from 'map-gl-geolocation';

const map = new Map({
    accessToken,
    container,
    style: 'mapbox://styles/mapbox/streets-v10'
});

// Create the geoloc logic behind the map.geolocation property
addGeolocationTo(map);

// Set the position and the heading to a custom location
map.geolocation.position = ({ lat: 43.608749, lng: 3.883528, accuracy: 10 });
map.geolocation.heading = 280;

// Add the specific control
map.addControl(new GeolocationControl());

Options

Refer to example for usage.

Test the project / Contribute

npm install & npm run dev

Go to http://localhost:3000/example/

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago