Skip to content

Files

Latest commit

6ceb87e · Jul 7, 2022

History

History

GeolocateControl

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Geolocate the user and then track their current location on the map using the GeolocateControl.

import React from 'react';
import MapGL, { GeolocateControl } from '@urbica/react-map-gl';
import 'mapbox-gl/dist/mapbox-gl.css';

<MapGL
  style={{ width: '100%', height: '400px' }}
  mapStyle='mapbox://styles/mapbox/light-v9'
  accessToken={MAPBOX_ACCESS_TOKEN}
  latitude={37.78}
  longitude={-122.41}
  zoom={11}
>
  <GeolocateControl position='top-right' />
</MapGL>;