Geocode UK

Introduction

The Geocode UK API is very simple, even so before you get started you should know the following:

  • You will need to create an API key.
  • All API methods must be called using the HTTPS (https://) protocol.
  • Responses from the API are returned in JSON.
  • For cross-domain support you can specify a callback parameter to use JSONP.

Geocoding

The geocode API method allows you to query the latitude and longitude of a place name or postcode in the UK and Republic of Ireland.

https://geo.getme.co.uk/api/v1/{api_key}/geocode?q={place_name|postcode}

{
      "status": "success",
      "matches": [
            {
                  "match": "Worcester",
                  "point": [52.197539997114895, -2.2135614625128284],
                  "county": "Worcestershire"
            },    {
                  "point": [51.375348744185246, -0.2413698281886533],
                  "county": "Sutton",
                  "match": "Worcester Park"
            }
      ]
}

Corrections

If a geocoding query returns no results then the response may o!er possible corrections to the query's spelling, for example worcestr would return:

{
      "status": "fail",
      "corrections": [
            "worcester"
            ],
      "hint": "No results found"
}

Suggestions

The matches returned by a geocoding query are ordered by the estimated size of the location - largest to smallest. You can suggest other possible locations using the additional matches, for example southend returns many possible matches:

{
      "status": "success",
      "matches": [
            {
                  "county": "Southend-on-Sea",
                  "match": "Southend-on-Sea",
                  "point": [51.5462374327005, 0.702723336581497]
             }, {
                  "county": "Lewisham",
                  "match": "Southend",
                  "point": [51.42559199907956, -0.009290370364616293]
            }, {
                  "county": "Buckinghamshire",
                  "match": "Southend",
                  "point": [51.59929241334181, -0.9113458891951862]
            }, {
                  "county": "West Berkshire",
                  "match": "Southend",
                  "point": [51.50384321230253, -1.3890765512873895]
            }, {
                  "county": "Gloucestershire",
                  "match": "Southend",
                  "point": [51.65770173098929, -2.370028966346895]
            }, {
                  "county": "Oxfordshire",
                  "match": "Southend",
                  "point": [51.709194262497824, -1.154750885146495]
            }, {
                  "county": "Argyll and Bute",
                  "match": "Southend",
                  "point": [55.31641546857859, -5.634269707310661]
            }
      ]
}

Autocomplete

The autocomplete API call allows you to provide users with autocomplete/typeahead on query inputs.

https://geo.getme.co.uk/api/v1/{API_KEY}/suggestions?q={start_of_place_name}

{
      "status": "success",
      "suggestions": [
            "Worcester",
            "Worcester Park"
      ]
}