maplibre / maplibre-gl-geocoder

Geocoding for MapLibre
ISC License
57 stars 19 forks source link

feat: suggestions API and UI feature #27

Closed TreTuna closed 2 years ago

TreTuna commented 2 years ago

Adds This PR brings functionality for a suggestions API.

AutoSuggest with Geocode on typing: autoSuggest

AutoSuggest only on typing: autoSuggestOnly

wipfli commented 2 years ago

Thanks for sharing this new feature. Is there an easy way to test this locally?

TreTuna commented 2 years ago

Thanks for sharing this new feature. Is there an easy way to test this locally?

Sure! If you have a sample app using the geocoder, you just need to add a fake getSuggestions API function into your geocodeApi object that's passed in. It doesn't need to call an API, just needs to return an array of strings that would be added to the results box.

You can see an example of how we're integrating it with our Amplify plugin here: https://github.com/aws-amplify/maplibre-gl-js-amplify/blob/main/src/AmplifyMapLibreGeocoder.ts