I need to find out whether a particular (well formatted) address is in "England", "Wales", "Scotland" or "Northern Ireland" if the address is in the UK.
My current requests to the Google Geocoding API return the city (e.g. "London") and the country ("United Kingdom") - both of these are useless to me.
Is there any way I can retrieve the information I need, or is a different web service required?
I'm not sure why the geocoding response does not return the administrative_area_level_1 for the UK when passing a complete address as a parameter.
However, in your case, what I would do is send the town name (instead of the complete address) to the geocoder which will return the data you need. Here some examples:
Note that I have added the Region Biasing parameter to the query so you will need to change it if you want to use it outside the UK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With