Donate using PayPal

CycleStreets API (v2)

  • Details for:
  • API overview
  • Obtain API key
  • Usage policy
  • Uptime policy

Nearest point

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.

Example

This example retrieves a location in Cambridge:

https://api.cyclestreets.net/v2/nearestpoint?lonlat=0.117950,52.205302

Result:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "name": "Senate House Hill, NCN 11"
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    0.117823,
                    52.205299
                ]
            }
        }
    ]
}

Request parameters - required

lonlat string
Comma-separated longitude,latitude of the point in degrees. The sixth decimal place corresponds to approximately 1 metre at the Earth's suface; any greater precision is unnecessary.

Request parameters - optional

name string
When the point is on a junction of streets this value is used as a hint to choose the street with the closest matching name.
fields string, default name
A comma-separated list of field names that should appear in the properties listing. Defaults to the single field: 'name'.
The permitted field names are:
  • name
  • island

Response

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:

name string
The point lies on a street with this name. Street names are based on OpenStreetMap ways.
island a positive integer
Cycle routes can only be found between points with the same island value.

Error response

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

We welcome your feedback, especially to report bugs or give us route feedback.

My comments relate to: *






Your comments: *
URL of page: * http://www.cyclestreets.dk/api/v2/nearestpoint/
How did you find out about CycleStreets?:
Your name:
Our ref: Please leave blank - anti-spam measure

* Items marked with an asterisk [*] are required fields and must be fully completed.