{"_id":"55e06b4058c5460d0076aa11","__v":5,"category":{"_id":"55e977bf358d923700be985d","project":"55e06494a44fae0d002146aa","__v":4,"pages":["5625f40751bf1c0d001f666e","5625f418f3adc80d004860a1","5625fc94eb610e0d0078dc90","5625feead0f87e190014c505"],"version":"55e06495a44fae0d002146ad","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-04T10:51:43.154Z","from_sync":false,"order":15,"slug":"endpoint-4","title":"endpoint"},"editedParams2":true,"user":"55e056b06bad670d0081f234","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"},"parentDoc":null,"editedParams":true,"project":"55e06494a44fae0d002146aa","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-28T14:08:00.995Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"name":"","code":"// Data returned for example query above truncated to one result\n{  \n   \"crs\":{  \n      \"properties\":{  \n         \"name\":\"BNG\"\n      },\n      \"type\":\"name\"\n   },\n   \"distance\":0.4884109154041967,\n   \"type\":\"Point\",\n   \"coordinates\":[  \n      115640.01244648322,\n      437165.4905361417\n   ]\n}\n","language":"json"},{"name":"","code":"// Example: Missing mandatory parameter\n{\n  \"error\": {\n    \"message\": \"No point parameter provided.\",\n    \"statuscode\": \"400\"\n  },\n  \"hints\": [{\"message\": \"No point parameter provided.\"}]\n}\n\n\n// Example: Parameter entry of wrong type\n{\n  \"error\": {\n    \"message\": \"Point x is not a valid point. Point must be a comma separated coordinate in BNG projection.\",\n    \"statuscode\": \"400\"\n  },\n  \"hints\": [{\"message\": \"Point x is not a valid point. Point must be a comma separated coordinate in BNG projection.\"}]\n}\n\n\n// Example: Wrong parameter name\n{\n  \"error\": {\n    \"message\": \"Parameter x is not a valid parameter for resource nearest. Valid parameters for requested resource are point, srs, output_srs.\",\n    \"statuscode\": \"400\"\n  },\n  \"hints\": [{\"message\": \"Parameter x is not a valid parameter for resource nearest. Valid parameters for requested resource are point, srs, output_srs.\"}]\n}","language":"json","status":400},{"language":"json","status":401,"code":"{\n    \"fault\": {\n        \"faultstring\": \"Invalid ApiKey\",\n        \"detail\": {\n            \"errorcode\": \"oauth.v2.InvalidApiKey\"\n        }\n    }\n}"},{"code":"{  \n   \"error\":{  \n      \"statuscode\":\"404\",\n      \"message\":\"Resource x does not exist. Valid resources are route, nearest.\"\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":"","examples":{"codes":[{"language":"javascript","name":"","code":"var req = new XMLHttpRequest();\nreq.open(\"GET\", \"https://api.ordnancesurvey.co.uk/routing_api/nearest?point=437165,115640&apikey=[[app:key]]\",true);\nreq.onreadystatechange = function () {\n    console.log(req.responseText);\n}\nreq.send();"},{"code":"var url = 'https://api.ordnancesurvey.co.uk/routing_api/nearest?point=437165,115640&apikey=[[app:key]]';\n\n$.getJSON(url, function(data){\n    console.log(data);\n})","language":"javascript","name":"JQuery"},{"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/routing_api/nearest?point=437165,115640';\n\t\t$http.get(query+'&apikey='+key).success(function(data) {\n\t\t\t$scope.output = data;\n\t\t});\n\t}]);\n</script>\n\n<body ng-controller=\"apiService\">\n\t<ul>\n\t\t<li ng-repeat= \"value in output\">\n\t\t\t<p>{{value}}</p>\n\t\t</li>\n\t</ul>\n</body>\n</html>","language":"html","name":"AngularJS"}]},"method":"get","auth":"required","params":[{"_id":"5625fe3bd0f87e190014c503","ref":"","in":"query","required":true,"desc":"Specify multiple points for which the route will be calculated. The order is important with the first point being the beginning of the route, with further points being added sequentially to the route. Specify at least two points. If the coordinates are not in BNG, then the SRS parameter will have to be corrected for this.","default":"","type":"string","name":"point"},{"_id":"5625fe3bd0f87e190014c502","ref":"","in":"query","required":false,"desc":"Specify the input coordinate system for the point parameter. It will also specify the output coordinate system unless the output_srs parameter is set. Only JSON format will be transformed on output as gpx is specified to be in WGS84. Default: bng","default":"bng, EPSG:27700, WGS:84, EPSG:4326","type":"string","name":"srs"},{"_id":"5625fe3bd0f87e190014c501","ref":"","in":"query","required":false,"desc":"Specify the output srs for your point list. Only JSON format will be transformed on output as gpx is specified to be in WGS84. Default: {srs value}","default":"bng, EPSG:27700, WGS:84, EPSG:4326","type":"string","name":"output_srs"}],"url":"/routing_api/nearest?"},"isReference":true,"order":2,"body":"","excerpt":"OS Routes Nearest (Vehicular)","slug":"os-routes-nearest","type":"endpoint","title":"Nearest (Vehicular)"}

getNearest (Vehicular)

OS Routes Nearest (Vehicular)

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

point:
required
string
Specify multiple points for which the route will be calculated. The order is important with the first point being the beginning of the route, with further points being added sequentially to the route. Specify at least two points. If the coordinates are not in BNG, then the SRS parameter will have to be corrected for this.
srs:
stringbng, EPSG:27700, WGS:84, EPSG:4326
Specify the input coordinate system for the point parameter. It will also specify the output coordinate system unless the output_srs parameter is set. Only JSON format will be transformed on output as gpx is specified to be in WGS84. Default: bng
output_srs:
stringbng, EPSG:27700, WGS:84, EPSG:4326
Specify the output srs for your point list. Only JSON format will be transformed on output as gpx is specified to be in WGS84. Default: {srs value}

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 }}