jeancochrane / mellow-bike-map

🚲 Web app and routing API for finding safe, chill bike routes. Like Google Maps if it took you through cozy side streets.
https://mellowbikemap.com
MIT License
13 stars 5 forks source link

Restrict maps autocomplete suggestions to USA #39

Closed kalilsn closed 2 years ago

kalilsn commented 2 years ago

This PR restricts autocomplete suggestions to only include US locations. This is in addition to the code which biases results to near your location, since that existing bias doesn't actually prevent international addresses from being suggested.

I was also considering changing the bounds to a static rect of Chicago instead of getting them from the user or at least defaulting to that. But TBH this change alone has already fixed most of the issue that I was experiencing so that may be unnecessary.

Here are two examples to illustrate:

Suggestions for "My Position" image

Suggestions for "is" image

And here's what those two look like after my change

No suggestions for "My position" (as it should be) image

Better results for "is" image