I'm trying to get a location based on an entered city name using the Google geocode api. I want to restrict the search to The Netherlands, Belgium and Germany and prioritize The Netherlands.
In the documentation I see that it's not possible to restrict to multiple countries, as the 'country' parameter only accepts a string and not an array as in the autocomplete api. https://developers.google.com/maps/documentation/javascript/geocoding#ComponentFiltering
Is it possible to do this with the geocode api?
I currently have this to restrict to just The Netherlands:
var request = { address: q, region: "NL", componentRestrictions: { country: "NL" } };
this.geocoder.geocode(request, function (results, status) {
debugger;
if (status === google.maps.GeocoderStatus.OK) {
var center = results[0].geometry.location;
ctx.map.setCenter(center);
ctx.map.setZoom(12);
ctx.onLocated(center, results[0], true);
}
});
Thanks!