smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 271 forks source link

feat: add MapBox provider #252

Closed nikitauskas closed 3 years ago

nikitauskas commented 3 years ago

Added new MapBox provider for GeoSearch.

example of usage: const provider = new MapBoxProvider({ params: { access_token: "ACCESS_TOKEN", }, });

An access token can be obtained here: https://docs.mapbox.com/accounts/overview/tokens/

nikitauskas commented 3 years ago

improved search results

smeijer commented 3 years ago

Thanks @nikitauskas ! This one is included in v3.3.0

dtropp commented 3 years ago

Thanks for this! Just what I needed.

Btw I used a different URL as v5 is the latest version. No other code changes were needed though:

    const host = "https://api.mapbox.com";
    this.searchUrl = options.searchUrl || `${host}/geocoding/v5/mapbox.places/`;
dtropp commented 3 years ago

@smeijer You don't seem to have updated the dist/ folder with the 3.3.0 release. I can't see the MapBoxProvider in dist but can see it in src.

smeijer commented 3 years ago

@dtropp, that was weird. Published a fix under 3.3.1. The provider is now included:

https://unpkg.com/browse/leaflet-geosearch@3.3.1/lib/providers/