mapbox / mapbox-gl-geocoder

Geocoder control for mapbox-gl-js using Mapbox Geocoding API
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
ISC License
362 stars 181 forks source link

reverseMode option type is unclear #499

Open coxco96 opened 1 year ago

coxco96 commented 1 year ago

I'm creating a Svelte component for a geocoder (student project). I've exported all of the geocoder default options, and all works fine, except for the reverseMode option. I don't think I understand the type of value it accepts.

According to the documentation:

options.reverseMode (distance | score) Set the factors that are used to sort nearby results. (optional, default distance)

I assumed these were strings, but when I set the default as 'distance,' while trying to perform a search, I get a console error stating that the key is invalid. I tried using numbers, but that did not work, either. For now, my component works fine if I just default it to undefined or leave it out altogether.

Apologies if I'm just confused here, but I got pretty stuck on this for awhile, so I thought I'd raise the issue. Clearer documentation on reverseMode would be helpful.