{"_id":"55e06a236bad670d0081f256","project":"55e06494a44fae0d002146aa","user":"55e056b06bad670d0081f234","__v":4,"editedParams":true,"editedParams2":true,"parentDoc":null,"version":{"_id":"55e06495a44fae0d002146ad","project":"55e06494a44fae0d002146aa","__v":54,"createdAt":"2015-08-28T13:39:33.907Z","releaseDate":"2015-08-28T13:39:33.907Z","categories":["55e06496a44fae0d002146ae","55e06997a44fae0d002146c2","55e06a6958c5460d0076aa0c","55e06ae66bad670d0081f25c","55e06cc1a44fae0d002146cb","55e06ddda44fae0d002146cd","55e95f261fd7e82300ef359f","55e95fe47fc27b2d00d32cfa","55e96eef358d923700be984d","55e96ef6358d923700be984e","55e96efda7ca823900ad547e","55e96f04a7ca823900ad547f","55e970cc358d923700be9853","55e973f4358d923700be9858","55e973f9a7ca823900ad548c","55e977bf358d923700be985d","55e9780f8b72bb3700b1d5bd","55e97815a7ca823900ad5493","55e9781c358d923700be985f","55e97821461e2a390050f23b","55f963c23bb4bb0d0022d18c","5624c67406e8040d005ed6b2","5624dcf25a86b423009462e8","5625f229d0f87e190014c4ed","5627819fe2ce610d004e3ec8","562781b23a4c6b0d00c4556b","5627837166c62617009d17e2","5627851efcbbc621004ebff1","5627860044c87f0d00fe6491","562e3c6d54a5be0d00070c3e","564c955aae6cb82100dc137a","5652e22abbe7110d00dba748","5652f25523d4262d00b21c58","5652fdad51e4e81900bf2452","5652fdcbb60abb1700bafadc","5654494f65bec717007e0293","565da11a77f0090d005818ff","565f063f413e06170093de18","565f06fb413e06170093de21","56dd6773efaca42900e5f58e","56dd68630c3bb41700b0b037","56dd7d24d5419f170075dfb3","56dd9448c117291700015b60","56dd9454c117291700015b61","577a6f8b9748b80e00ef3f45","577a6f969748b80e00ef3f46","577bba7f6e5f301900fada99","57a9cc8e5b1ace0e00de743f","58aab134c50c33250046b8f8","58aab146aecc3e2500573d4c","58aab1628f862f250076f92e","58aab1938f862f250076f92f","58aab3e5aecc3e2500573d56","58aab3f2aecc3e2500573d57"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"55e95fe47fc27b2d00d32cfa","pages":["55ed65182e66b62100994163"],"version":"55e06495a44fae0d002146ad","project":"55e06494a44fae0d002146aa","__v":1,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-04T09:09:56.318Z","from_sync":false,"order":8,"slug":"endpoint","title":"endpoint"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-28T14:03:15.115Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"javascript","code":"var req = new XMLHttpRequest();\nreq.open(\"GET\", \"https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293,115515&key=[[app:key]]\",true);\nreq.onreadystatechange = function () {\n    console.log(req.responseText);\n}\nreq.send();","name":""},{"name":"JQuery","language":"javascript","code":"var url = 'https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293,115515&key=[[app:key]]';\n\n$.getJSON(url, function(data){\n    console.log(data);\n})"},{"code":"var https = require('https');\n\nhttps.get(\"https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293,115515&key=[[app:key]]\", function(res) {\n  console.log(\"Got response: \" + res.statusCode);\n  res.on('data', function(d) {\n    process.stdout.write(d);\n  });\n}).on('error', function(e) {\n  console.log(\"Got error: \" + e.message);\n});","name":"Node.js","language":"javascript"},{"language":"php","code":"<?php\n    $curl = curl_init();\n    curl_setopt ($curl, CURLOPT_URL, \"https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293,115515&key=[[app:key]]\");\n    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n\n    $result = curl_exec ($curl);\n    curl_close ($curl);\n    print \"<pre>$result\";\n?>"},{"language":"html","code":"<html lang=\"en\" ng-app=\"angularAPI\">\n<head>\n  <meta charset=\"utf-8\">\n  <script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js\"></script>\n</head>\n\n<script type=\"text/javascript\">\n\tvar osAPI = angular.module('angularAPI', []);\n\n\tosAPI.controller('apiService', ['$scope', '$http', function($scope, $http) {\n\t\tvar key = \"[[app:key]]\";\n\t\tvar query = 'https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293,115515';\n\t\t$http.get(query+'&key='+key).success(function(data) {\n\t\t\t$scope.output = data.results;\n\t\t});\n\t}]);\n</script>\n\n<body ng-controller=\"apiService\">\n\t<ul ng-repeat=\"value in output\">\n\t\t<li ng-repeat=\"object in value\">\n\t\t\t<p>{{object}}</p>\n\t\t</li>\n\t</ul>\n</body>\n</html>","name":"AngularJS"}]},"method":"get","results":{"codes":[{"name":"OK - JSON","code":"{\n  \"header\" : {\n    \"uri\" : \"https://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293%2C115515\",\n    \"query\" : \"point=437293,115515 radius=100\",\n    \"offset\" : 0,\n    \"totalresults\" : 1,\n    \"format\" : \"JSON\",\n    \"dataset\" : \"DPA\",\n    \"lr\" : \"EN,CY\",\n    \"maxresults\" : 1,\n    \"epoch\" : \"37\",\n    \"output_srs\" : \"EPSG:27700\"\n  },\n  \"results\" : [ {\n    \"DPA\" : {\n      \"UPRN\" : \"200010019924\",\n      \"ADDRESS\" : \"ORDNANCE SURVEY, 4, ADANAC DRIVE, NURSLING, SOUTHAMPTON, SO16 0AS\",\n      \"ORGANISATION_NAME\" : \"ORDNANCE SURVEY\",\n      \"BUILDING_NUMBER\" : \"4\",\n      \"THOROUGHFARE_NAME\" : \"ADANAC DRIVE\",\n      \"DEPENDENT_LOCALITY\" : \"NURSLING\",\n      \"POST_TOWN\" : \"SOUTHAMPTON\",\n      \"POSTCODE\" : \"SO16 0AS\",\n      \"RPC\" : \"2\",\n      \"X_COORDINATE\" : 437318.0,\n      \"Y_COORDINATE\" : 115539.0,\n      \"STATUS\" : \"APPROVED\",\n      \"LOGICAL_STATUS_CODE\" : \"1\",\n      \"CLASSIFICATION_CODE\" : \"CO01GV\",\n      \"CLASSIFICATION_CODE_DESCRIPTION\" : \"Central Government Service\",\n      \"LOCAL_CUSTODIAN_CODE\" : 1760,\n      \"LOCAL_CUSTODIAN_CODE_DESCRIPTION\" : \"TEST VALLEY\",\n      \"POSTAL_ADDRESS_CODE\" : \"S\",\n      \"POSTAL_ADDRESS_CODE_DESCRIPTION\" : \"A single address\",\n      \"BLPU_STATE_CODE\" : \"2\",\n      \"BLPU_STATE_CODE_DESCRIPTION\" : \"In use\",\n      \"TOPOGRAPHY_LAYER_TOID\" : \"osgb1000002682081995\",\n      \"LAST_UPDATE_DATE\" : \"01/09/2010\",\n      \"ENTRY_DATE\" : \"01/09/2010\",\n      \"BLPU_STATE_DATE\" : \"01/09/2010\",\n      \"LANGUAGE\" : \"EN\",\n      \"MATCH\" : 1.0,\n      \"MATCH_DESCRIPTION\" : \"EXACT\"\n    }\n  } ]\n}","language":"json","status":200},{"language":"xml","status":200,"name":"OK - XML","code":"<AddressAPI>\n\t<header>\n\t\t<uri>\nhttps://api.ordnancesurvey.co.uk/places/v1/addresses/nearest?point=437293%2C115515&format=xml\n\t\t</uri>\n\t\t<query>point=437293,115515 radius=100</query>\n\t\t<offset>0</offset>\n\t\t<totalresults>1</totalresults>\n\t\t<format>xml</format>\n\t\t<dataset>DPA</dataset>\n\t\t<lr>EN,CY</lr>\n\t\t<maxresults>1</maxresults>\n\t\t<epoch>37</epoch>\n    <output_srs>EPSG:27700</output_srs>\n\t</header>\n\t<results>\n\t\t<DPA>\n\t\t\t<UPRN>200010019924</UPRN>\n\t\t\t<ADDRESS>\nORDNANCE SURVEY, 4, ADANAC DRIVE, NURSLING, SOUTHAMPTON, SO16 0AS\n\t\t\t</ADDRESS>\n\t\t\t<ORGANISATION_NAME>ORDNANCE SURVEY</ORGANISATION_NAME>\n\t\t\t<BUILDING_NUMBER>4</BUILDING_NUMBER>\n\t\t\t<THOROUGHFARE_NAME>ADANAC DRIVE</THOROUGHFARE_NAME>\n\t\t\t<DEPENDENT_LOCALITY>NURSLING</DEPENDENT_LOCALITY>\n\t\t\t<POST_TOWN>SOUTHAMPTON</POST_TOWN>\n\t\t\t<POSTCODE>SO16 0AS</POSTCODE>\n\t\t\t<RPC>2</RPC>\n\t\t\t<X_COORDINATE>437318.0</X_COORDINATE>\n\t\t\t<Y_COORDINATE>115539.0</Y_COORDINATE>\n\t\t\t<STATUS>APPROVED</STATUS>\n\t\t\t<LOGICAL_STATUS_CODE>1</LOGICAL_STATUS_CODE>\n\t\t\t<CLASSIFICATION_CODE>CO01GV</CLASSIFICATION_CODE>\n\t\t\t<CLASSIFICATION_CODE_DESCRIPTION>Central Government Service</CLASSIFICATION_CODE_DESCRIPTION>\n\t\t\t<LOCAL_CUSTODIAN_CODE>1760</LOCAL_CUSTODIAN_CODE>\n\t\t\t<LOCAL_CUSTODIAN_CODE_DESCRIPTION>TEST VALLEY</LOCAL_CUSTODIAN_CODE_DESCRIPTION>\n\t\t\t<POSTAL_ADDRESS_CODE>S</POSTAL_ADDRESS_CODE>\n\t\t\t<POSTAL_ADDRESS_CODE_DESCRIPTION>A single address</POSTAL_ADDRESS_CODE_DESCRIPTION>\n\t\t\t<BLPU_STATE_CODE>2</BLPU_STATE_CODE>\n\t\t\t<BLPU_STATE_CODE_DESCRIPTION>In use</BLPU_STATE_CODE_DESCRIPTION>\n\t\t<TOPOGRAPHY_LAYER_TOID>osgb1000002682081995</TOPOGRAPHY_LAYER_TOID>\n\t\t\t<LAST_UPDATE_DATE>01/09/2010</LAST_UPDATE_DATE>\n\t\t\t<ENTRY_DATE>01/09/2010</ENTRY_DATE>\n\t\t\t<BLPU_STATE_DATE>01/09/2010</BLPU_STATE_DATE>\n\t\t\t<LANGUAGE>EN</LANGUAGE>\n\t\t\t<MATCH>1.0</MATCH>\n\t\t\t<MATCH_DESCRIPTION>EXACT</MATCH_DESCRIPTION>\n\t\t</DPA>\n\t</results>\n</AddressAPI>"},{"language":"json","status":400,"code":"// Example: Missing mandatory parameter\n{\n  \"error\" : {\n    \"statuscode\" : 400,\n    \"message\" : \"No point parameter provided.\"\n  }\n}\n\n// Example: Parameter entry of wrong type\n{\n  \"error\" : {\n    \"statuscode\" : 400,\n    \"message\" : \"Point must be a comma separated coordinate in British National Grid projection to 2 decimal places or less. Requested point was x\"\n  }\n}\n\n// Example: Wrong parameter name\n{\n  \"error\" : {\n    \"statuscode\" : 400,\n    \"message\" : \"Parameter x is not a valid parameter for resource nearest. Valid parameters for requested resource are point, radius, format, dataset, lr, fq.\"\n  }\n}"},{"code":"{\n    \"fault\": {\n        \"faultstring\": \"Invalid ApiKey\",\n        \"detail\": {\n            \"errorcode\": \"oauth.v2.InvalidApiKey\"\n        }\n    }\n}","language":"json","status":401},{"code":"{\n     \"error\": {\n         \"statuscode\": \"404\",\n         \"message\": \"Resource x does not exist. Valid resources are  match, find, uprn, postcode, nearest, bbox, radius.\"\n     }\n}","language":"json","status":404},{"code":"{  \n   \"fault\":{  \n      \"faultstring\":\"Received 405 Response without Allow Header\",\n      \"detail\":{  \n         \"errorcode\":\"protocol.http.Response405WithoutAllowHeader\"\n      }\n   }\n}","language":"json","status":405},{"code":"{\n    \"error\": {\n        \"statuscode\": 500,\n        \"message\": \"The provided request resulted in an internal server error.\"\n    }\n}","language":"json","status":500}]},"settings":"55e96024e5d0c623003ed884","auth":"required","params":[{"_id":"55e9687e358d923700be9847","ref":"","in":"query","required":true,"desc":"One comma-separated coordinate set that specifies the coordinate to which the nearest record in a straight line should be found. The maximum distance the search will try is 1,000 metres. The precision of the coordinates is to two decimal places (that is, 1 cm accuracy).","default":"","type":"string","name":"point"},{"_id":"55e9687e358d923700be9846","ref":"","in":"query","required":false,"desc":"The radius in metres to search within. Maximum is 1,000 metres. If the radius exceeds that amount then an error message will be returned (see below). The precision of the distance is to two decimal places (that is, 1 cm accuracy). Default: 100","default":"0.01-1000","type":"double","name":"radius"},{"_id":"55e9687e358d923700be9845","ref":"","in":"query","required":false,"desc":"The format in which the response will be returned. Default: JSON","default":"JSON, XML","type":"string","name":"format"},{"_id":"55e9687e358d923700be9844","ref":"","in":"query","required":false,"desc":"The dataset to return. Multiple values can be sent, separated by a comma. Default: DPA","default":"DPA, LPI","type":"string","name":"dataset"},{"_id":"55e9687e358d923700be9843","ref":"","in":"query","required":false,"desc":"Which language of addresses to return. Valid languages are English and Welsh. Filter only applicable to DPA dataset. Default: EN, CY","default":"EN, CY","type":"string","name":"lr"},{"_id":"55e9687e358d923700be9842","ref":"","in":"query","required":false,"desc":"A filter that allows filtering of results by classification code and/or logical status code. Filtering for classification code will accept wildcard (*) searches. Multiple searches can be done on classification code separating the classification code parameter with a space. Classification code filters can be ran with logical status code filters by using the parameter multiple times: fq=classification_code:CI classification_code:RD&fq=LOGICAL_STATUS_CODE:6 . Valid: classification_code:[code], LOGICAL_STATUS_CODE:[code]","default":"classification_code:[code], LOGICAL_STATUS_CODE:[code]","type":"string","name":"fq"},{"_id":"56ab5487f25f160d00e17eb8","ref":"","in":"query","required":false,"desc":"The intended output spatial reference system. Default: EPSG:27700","default":"BNG, EPSG:27700, WGS84, EPSG:4326, EPSG:3857, EPSG:4258","type":"string","name":"output_srs"},{"_id":"56ab557ed4432d1900eed165","ref":"","in":"query","required":false,"desc":"The spatial reference system for the input coordinate set.","default":"BNG, EPSG:27700, WGS84, EPSG:4326, EPSG:3857, EPSG:4258","type":"string","name":"srs"}],"url":"/v1/addresses/nearest?"},"isReference":true,"order":5,"body":"","excerpt":"OS Places Nearest","slug":"os-places-nearest","type":"endpoint","title":"Nearest"}

getNearest

OS Places Nearest

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

point:
required
string
One comma-separated coordinate set that specifies the coordinate to which the nearest record in a straight line should be found. The maximum distance the search will try is 1,000 metres. The precision of the coordinates is to two decimal places (that is, 1 cm accuracy).
radius:
double0.01-1000
The radius in metres to search within. Maximum is 1,000 metres. If the radius exceeds that amount then an error message will be returned (see below). The precision of the distance is to two decimal places (that is, 1 cm accuracy). Default: 100
format:
stringJSON, XML
The format in which the response will be returned. Default: JSON
dataset:
stringDPA, LPI
The dataset to return. Multiple values can be sent, separated by a comma. Default: DPA
lr:
stringEN, CY
Which language of addresses to return. Valid languages are English and Welsh. Filter only applicable to DPA dataset. Default: EN, CY
fq:
stringclassification_code:[code], LOGICAL_STATUS_CODE:[code]
A filter that allows filtering of results by classification code and/or logical status code. Filtering for classification code will accept wildcard (*) searches. Multiple searches can be done on classification code separating the classification code parameter with a space. Classification code filters can be ran with logical status code filters by using the parameter multiple times: fq=classification_code:CI classification_code:RD&fq=LOGICAL_STATUS_CODE:6 . Valid: classification_code:[code], LOGICAL_STATUS_CODE:[code]
output_srs:
stringBNG, EPSG:27700, WGS84, EPSG:4326, EPSG:3857, EPSG:4258
The intended output spatial reference system. Default: EPSG:27700
srs:
stringBNG, EPSG:27700, WGS84, EPSG:4326, EPSG:3857, EPSG:4258
The spatial reference system for the input coordinate set.

Examples


Result Format


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}