Google Geocoding API - Search in one country only

I am looking for geocodes with google geocode-API:

http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK&sensor=false

      

The problem is that the input is not very accurate (especially on the street) and sometimes google mix things up and ignore the UK because the street has a perfect match (like street and city) somewhere else. for example the USA.

Now I can't seem to solve this problem (input), but I'm wondering if there is a parameter that makes Google search in the UK and not return a result, not a completely wrong result.

+3


source to share


1 answer


You can add component filters in the url to get the constraint results. In this case, you can use:

http://maps.googleapis.com/maps/api/geocode/json?address=london%c2+UK**&components=country:UK**&sensor=false

      



For details on how to use component filtering, see below:

https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering

+8


source







All Articles