@mapbox/mapbox-gl-geocoder
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/mapbox__mapbox-gl-geocoder package

5.0.2 • Public • Published

Mapbox GL Geocoder Build Status

A geocoder control for mapbox-gl-js using the Mapbox Geocoding API. For a JavaScript geocoder without a graphical user interface see the Mapbox SDK for JS.

Usage

If you are supporting older browsers, you will need to use a polyfill. We recommend working with @babel/polyfill.

Usage with a module bundler

npm install --save @mapbox/mapbox-gl-geocoder
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 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 for complete reference.

Examples

See https://docs.mapbox.com/mapbox-gl-js/examples/#geocoder.

Contributing

See CONTRIBUTING.md.

Readme

Keywords

Package Sidebar

Install

npm i @mapbox/mapbox-gl-geocoder

Weekly Downloads

84,774

Version

5.0.2

License

ISC

Unpacked Size

164 kB

Total Files

13

Last publish

Collaborators

  • mbx-npm-ci-production
  • mbx-npm-ci-staging
  • mbx-npm-advanced-actions-production
  • mbx-npm-advanced-actions-staging
  • mbx-npm-09-production
  • mbx-npm-08-production
  • mbx-npm-07-production
  • mbx-npm-06-production
  • mbx-npm-05-production
  • mbx-npm-04-production
  • mbx-npm-03-production
  • mbx-npm-02-production
  • mbx-npm-01-production
  • mbx-npm-02-staging
  • mapbox-npm-01
  • mapbox-npm-02
  • mapbox-npm-07
  • mapbox-npm-03
  • mapbox-npm-04
  • mapbox-npm-09
  • mapbox-npm-05
  • mapbox-npm-06
  • mapbox-npm-08
  • mapbox-npm-advanced-actions
  • mapbox-npm-ci
  • mapbox-npm
  • mapbox-admin
  • mapbox-machine-user