Skip to the content

FindMyNearest

Returns a list of results sorted by shortest distance from the given point.

Live Demo

To connect to this service you'll need to use one of these endpoints:

JSON
Open API
SOAP

Description

Finds the distance any given point is, in metres or miles, from the locations in a specified dataset. The use of this service requires additional setup of a dataset containing relevant locations you wish to be compared.

For the best results, a full postcode should be supplied. However, the service will also accept partial postcodes or other parts of an address.

Credit Usage

Each request to this method consumes 1 Geocoding credit and 1 Find My Nearest credit

Parameters

The following parameters can be supplied to this method

username

username

See the available authentication methods. If you are using username & password authentication, specify the username to authenticate as. If you are using API Key authentication and you are not using the JSON, Javascript or ADO APIs, use your API Key here with the prefix apikey-, e.g. apikey-ABCD-1234-EFGH-5678
password

password

If you are using username & password authentication, specify the password to use for authentication. Otherwise leave this blank.
licence

licence

The licence type under which you are accessing the service. If you are not sure which value to pick, please contact your account manager

point

point

The point to use as the origin of the find my nearest search. This can be either a full postcode or a partial address. Using a full postcode will ensure the most accurate results are achieved.

dataset

dataset

The name of the predefined dataset of locations to find the nearest one from.

options

options

An array of options that control further details of how this method operates. See the Advanced Options section below for more information.

Advanced Options

The following options can be specified as part of the option parameter. Each option is specified as a key/value pair. The list of available names is shown below, along with a description of the allowable values for that name.

Common Options
Name Description
ApplicationName

ApplicationName

Gives the name of the calling application - used to break down usage by application in the usage reports on the dashboard
Service-Specific Options
Name Description
DatumEPSG

DatumEPSG

The EPSG code of the datum to use when converting the original OS grid coordinates to latitude and longitude

MaxMatches

MaxMatches

The number of addresses to limit the response to.

Results

This method returns an object containing the following fields:

Status

Status

Indicates whether the method call was successful, or if some error occurred. If the Success field is true, the other results described below can be used to get the results of the method. If Success is false, some error occurred in calling the method, such as the authentication failed or the account is out of credits. The details of the error can be obtained from the ErrorMessage field, and any other results should be ignored
Distances

Distances

The cleansed address of the initial point stored in the Position attribute, and a list of distances for matched addresses, sorted by closest first, stored in the Distances attribute. Each matched address is made up of a PointOfInterest (containing a name, full address, contact details etc), and the distance in metres and miles from the origin point.

Each Distance contains the following fields:

Name Description
Miles The distance in miles from the original point.
Metres The distance in metres from the original point.
PointOfInterest Information about the matched point including a name, full address and contact details:
Name Description
Address A formatted version of the POI's address
Description A description of the POI
Email A contact email address for the POI
Fax A contact fax number for the POI
Position The position data of the POI:
Name Description
Easting The distance of the postcode east of the OS grid origin to the southwest of Scilly
Northing The distance of the postcode north of the OS grid origin
GridReference The location of the postcode as a 6-digit OS grid reference
Longitude The longitude of the postcode expressed in decimal degrees in the WGS84 datum
Latitude The latitude of the postcode expressed in decimal degrees in the WGS84 datum
CountyCode The reference code for the county the postcode is in
County The name of the administrative county the postcode is in
DistrictCode The reference code for the district the postcode is in
District The name of the administrative district the postcode is in
WardCode The reference code for the ward the postcode is in
Ward The name of the electoral ward the postcode is in
Country The name of the country the postcode is in
Telephone A contact telephone number for the POI
Title A title for the POI
Website The website associated with the POI

Live Demo

licence
point
dataset
options
Name Value
Common Options
Service-Specific Options

Sample Code