Gian 948fd2e4f4
fix(geocoder): add styles for example (#2521)
Co-authored-by: Xiaoji Chen <Pessimistress@users.noreply.github.com>
Co-authored-by: Chris Gervang <chrisgervang@users.noreply.github.com>
2025-05-19 17:14:08 -07:00
..
2025-01-28 10:32:41 -08:00

Example: Geocoder

This app reproduces Mapbox's Add a geocoder example.

Usage

To run this example, you need a Mapbox token. You can either set it as MAPBOX_TOKEN in src/app.js, or set a MapboxAccessToken environment variable in the command line.

npm i
npm run start

Alternative to acquiring a Mapbox token, you can use maplibre-gl instead. Follow these steps:

  • Run npm install maplibre-gl
  • In the source, change all import ... from 'react-map-gl/mapbox' to import ... from 'react-map-gl/maplibre'
  • Change the mapStyle prop of <Map> to "https://demotiles.maplibre.org/style.json" or a self-hosted URL