Signup Login

Reverse Geo-Code

API Method: reverse_geo_code

Description

Converts a position (latitude, longitude) into the nearest UK address and postcode.

Mandatory Parameters

Name Description
api_key or javascript_key Use your API key if invoking server-side. If invoking from the browser via JavaScript, generate a JavaScript key using the javascript_key method.
latitude WGS 84(GPS) co-ordinates.
longitude WGS 84(GPS) co-ordinates.

Optional Parameters

Name Description
client You can optionally include an identifier for your final client or user. This is logged in your usage log and you will be able to view your usage statistics by client.
output Set to json for a JSON response; the default response is XML. Not applicable to the SOAP API.
callback When using JSON, specify a JSONP wrapper in which the JSON response is to be wrapped.

Returned Values

The XML response is contained within a <reverse_geo_code_res> element.

Name Description
status Returns ok if the operation has succeeded, or error if an error has occurred; Returns the error_code for error details.
error_code Returns the error code when the status is error. See below for error codes.
t2a_version_number The current API version number.
credit_used The number of credits used in order to execute the request.
mode Returns normal or test when executed in the free test mode.
address An address record, the closest to the specified co- ordinates.

Error Codes

See the common error codes. There are no errors which are specific to this method.

Free Test Mode

When operating in the free test mode errors are returned if mandatory parameters are missing, or it returns a dummy data response, in an identical format to a real response.

Note that the mode is returned as test when the method is operating in the free test mode.

Example XML Response


<?xml version="1.0"?>
<reverse_geo_code_res>
  <t2a_version_number>1.0.0.8</t2a_version_number>
  <status>ok</status>
  <address>
	<line_1>4 Imagination Gardens</line_1>
	<line_2>Magic Street</line_2>
	<line_3 />
	<place>Heslingdown</place>
	<town>York</york>
	<addr_single_line>4 Imagination Gardens, Magic Street, Heslingdown, York, YO10 5DG</addr_single_line>
	<postcode>YO10 5DG</postcode>
  </address>
</reverse_geo_code_res>