--- layout: api title: "v1.6.1 API: L.mapbox.geocoderControl(id|url, options)" categories: api version: v1.6.1 permalink: /api/v1.6.1/l-mapbox-geocodercontrol --- {% raw %}
Adds geocoder functionality as well as a UI element to a map. This uses the Mapbox Geocoding API.
Options | Value | Description |
---|---|---|
id or url (required) | string | Either a
|
options | object | An options argument with the same options as the L.Control class, as well as:
|
Example:
var map = L.map('map')
.setView([37, -77], 5)
.addControl(L.mapbox.geocoderControl('examples.map-i875kd35'));
Returns a L.mapbox.geocoderControl
object.
Set the url used for geocoding.
Options | Value | Description |
---|---|---|
url | string | A geocoding url |
Returns: the geocoder control object
Set the map id used for geocoding.
Options | Value | Description |
---|---|---|
id | string | A map id to geocode from |
Returns: the geocoder control object
Set the TileJSON used for geocoding.
Options | Value | Description |
---|---|---|
tilejson | object | A TileJSON object |
Returns: the geocoder object
Bind a listener to an event emitted by the geocoder control. Supported additional events are
Options | Value | Description |
---|---|---|
event | string |
|
event | string |
|
event | string |
|