I have a form in my PHP application which searches for locations in europe: Germany, France, Poland, Czech Republic, Spain, Austria, Romania, Italy.
This is my base query:
$address = "https://maps.googleapis.com/maps/api/geocode/json?address={$input}";
If the users tries to find "mannheim" for example, it should return Mannheim, Germany.
Instead it returns a point in Pennsylvania, US. I tried adding this address component restriction: &components=administrative_area:EU,
but this is not reliable because instead of finding Mannheim Germany, it points to a place 300 km away:
If I append , Germany
:
$address = "https://maps.googleapis.com/maps/api/geocode/json?address={$input}, Germany";
then the response is correct.
Is there a way to specify some countries for which the search should happen?
A last resort is to make a separate search for each country, but this would be really slow given the ~10-12 countries I search in.