Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mapbox/mapbox-gl-geocoder
Geocoder control for mapbox-gl-js using Mapbox Geocoding API
https://github.com/mapbox/mapbox-gl-geocoder
geocoding mapbox-gl-js plugin
Last synced: 2 months ago
JSON representation
Geocoder control for mapbox-gl-js using Mapbox Geocoding API
- Host: GitHub
- URL: https://github.com/mapbox/mapbox-gl-geocoder
- Owner: mapbox
- License: isc
- Created: 2015-12-14T03:29:56.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T14:11:10.000Z (8 months ago)
- Last Synced: 2024-06-11T17:12:22.405Z (7 months ago)
- Topics: geocoding, mapbox-gl-js, plugin
- Language: JavaScript
- Homepage: https://mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
- Size: 2.7 MB
- Stars: 356
- Watchers: 116
- Forks: 182
- Open Issues: 108
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Mapbox GL Geocoder [![Build Status](https://travis-ci.com/mapbox/mapbox-gl-geocoder.svg?branch=master)](https://travis-ci.com/mapbox/mapbox-gl-geocoder)
---A geocoder control for [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) using the [Mapbox Geocoding API](https://docs.mapbox.com/api/search/#geocoding). For a JavaScript geocoder without a graphical user interface see the [Mapbox SDK for JS](https://github.com/mapbox/mapbox-sdk-js/blob/master/docs/services.md#geocoding).
### Usage
* https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
* https://docs.mapbox.com/mapbox-gl-js/example/?search=mapbox-gl-geocoder**If you are supporting older browsers, you will need to use a polyfill.** We recommend working with [@babel/polyfill](https://babeljs.io/docs/en/babel-polyfill).
### Usage with a module bundler
```bash
npm install --save @mapbox/mapbox-gl-geocoder
``````js
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder';
import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css';
...
const geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl
});```
### Using without a Map
It is possible to use the plugin without it being placed as a control on a mapbox-gl map. Keep in mind that the Mapbox [Terms of Service](https://www.mapbox.com/legal/tos#[GAGA]) require that POI search results be shown on a Mapbox map. If you don't need POIs, you can exclude them from your search results with the `options.types` parameter when constructing a new Geocoder.### Deeper dive
#### API Documentation
See [API.md](https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md) for complete reference.
#### Examples
See [https://docs.mapbox.com/mapbox-gl-js/examples/#geocoder](https://docs.mapbox.com/mapbox-gl-js/examples/#geocoder).
### Contributing
See [CONTRIBUTING.md](https://github.com/mapbox/mapbox-gl-geocoder/blob/master/CONTRIBUTING.md).