Contents:
This API call finds the nearest point on the cyclable network.
This means that you can then show this name as a user-friendly marker-with-name rather than just a marker, and/or move the marker to the actual point which the route planner would use.
It returns the location of nearest point to the given longitude / latitude on the cyclable network. They may be up to about a kilometre away from the given point.
Nearestpoint avoids hostile roads, uncyclable footways, and ferry routes.
Using this API in a GUI can improve the user experience by showing the user the exact locations before a route is planned. The journey API call internally uses nearestpoint to determine actual waypoints when 'unsnapped' locations are sent.
This example retrieves a location in Cambridge:
https://api.cyclestreets.net/v2/nearestpoint?lonlat=0.11795,52.20530
Result:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "name": "Senate House Hill, NCN 11" }, "geometry": { "type": "Point", "coordinates": [ 0.11782, 52.20530 ] } } ] }
GeoJSON object containing one Point feature, as per example above containing the co-ordinates in WGS84 degrees of the longitude and latitude of the nearest on the cyclable (or walkable) network. The nearest point may be up to approximately 1km from the requested location. Includes the following properties as specified by the fields parameter:
JSON object containing an error key and a text string.
Example error (text string will vary):
{ "error": "Could not find a nearby point on the routeable cycle network" }