Add a geocoder | Mapbox GL JS (original) (raw)

Additional Developer Resources

This example adds a geocoding control to a web map, enabling users to search the map for a place.

It adds the control by loading the mapbox-gl-geocoder plugin inside a <script> tag, then using map.addControl to add the control with MapboxGeocoder defined in the options. The MapboxGeocoder object uses the Mapbox Geocoding API to enable places search.

Search for a place like Moulin Rouge to test the geocoder control.

To explore how geocoding query parameters affect places search results, use the Search playground.

Additional Developer Resources

Was this example helpful?