1
votes

I'm trying to implement Geocoding with Mapbox. To get better results I want to limit my search to one country. I found this guide on how to do that. But unfortunatly when I do it in my code:

$(document).on('keyup', "#place", 
function() {
    var text = $(this).val();
    if (text.length >= 5) {
      geocoder.query({query:text, country:'de'}, setMap());
    }

it seems to ignore the country-options and searches worldwide...

Check out this minimal Jsfiddle.

Can anyone please help me?

1

1 Answers

2
votes

A wrote the Mapbox Support Team. Unfortunatly limitation by country is not (yet) support via geocode.query. But you can use country limited search via the API.