Search code examples
google-mapsgoogle-maps-api-3geolocationgoogle-geocoding-apipostal-code

Getting the suburb for a UK address or geocode


I am looking to get the Suburb from an input of an address or geocode (lat , lng or IP)

By Suburb I mean something like the following.

The UK Postcode : EH11 1AF is in the suburb of "Fountainbridge". There are many suburbs across the city of Edinburgh such as, "Haymarket, Barnton, Corstorphine, Comely Bank".

When I use the google reverse geocoding API such as :

/maps/api/geocode/json passing a lat,lng parameter

The response does not contain the suburb - see : http://maps.googleapis.com/maps/api/geocode/json?latlng=55.958712899999995,-3.216021&sensor=true

Is there an API which will help me to derive the suburb name based upon any part of a geocode or address, or postcode!? I am struggling to find such a service


Solution

  • Turns out geonames.org does indeed give what I need, take a look at this :

    A latitude and longitude in Stockbridge, has a name of stockbridge: http://api.geonames.org/findNearbyPlaceNameJSON?formatted=true&lat=55.958712899999995&lng=-3.216021&username=demo&style=full tested it and it seems to work very well!