Donate using PayPal

CycleStreets API (v2)

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

Traffic counts data

The traffic counts data API provides traffic counts, for all types of vehicles, on main roads around Great Britain, from 2000.

This includes all data from 2000 to 2016 inclusive.

Data comes from the Department for Transport, who publish a data guide.

An example usage of this API can be seen on the Bikedata website.

Currently, lines are not yet snapped to exact road geometries; for now, straight lines are given. This limitation will be removed in future. Please let us know if this requirement is a priority for you.

Example

Example which retrieves traffic counts in the area around Blackfriars Bridge, London.

https://api.cyclestreets.net/v2/trafficcounts.locations?key=registeredapikey&groupyears=1&bbox=-0.115035,51.508596,-0.092783,51.515393

Result:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "id": "18468",
                "westminstername": null,
                "boroughname": null,
                "wardname": null,
                "road": "A3211",
                "road_type": "Class A Principal road in Urban area",
                "cycle_pcu": "2217.2000000000003",
                "p2w_pcu": "1517.6000000000001",
                "car_pcu": "20925",
                "bus_pcu": "1240",
                "lgv_pcu": "5609",
                "mgv_pcu": "1102.5",
                "hgv_pcu": "1228.1999999999998",
                "minyear": "2000",
                "maxyear": "2016",
                "cycles": "1126,1166,2571,1137,2233,2517,4819,2471,2419,3925,5262,4002,5001,6586,6608,8294,11086",
                "p2w": "4635,5223,5889,6155,5830,5521,8299,5588,5213,6449,6455,5523,4103,7192,7323,5523,3794",
                "cars": "51060,47741,49115,54507,49276,49424,48517,49205,47433,47216,43766,38526,32481,41045,42446,31377,20925",
                "buses": "0,0,1271,932,1740,1729,1349,880,934,1250,1208,1436,1033,1295,1255,1149,620",
                "lgvs": "2592,2584,9167,6357,8297,9259,10205,10933,10233,8458,8486,7148,7128,9016,9392,8307,5609",
                "mgvs": "5651,5210,1265,1493,936,1033,1156,1190,1167,1619,1698,2000,1430,1570,1559,1459,735",
                "hgvs": "3399,3648,404,471,242,248,529,680,695,376,632,1189,517,1203,1264,897,534",
                "all_motors": "67337,64406,67111,69915,66321,67214,70055,68476,65675,65368,62245,55822,46692,61321,63239,48712,32217",
                "all_motors_pcu": "71800.2,68619.59999999999,66006.3,68512.8,65345.6,66469.29999999999,67690.3,67482.2,64968.2,64046.9,61250.6,56489.899999999994,46650.299999999996,60649.700000000004,62522.899999999994,48442.799999999996,31622.3"
            },
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [
                        -0.11155330606847,
                        51.510951517408
                    ],
                    [
                        -0.10443288404736,
                        51.510980533165
                    ]
                ]
            }
        },
        {
            "type": "Feature",
            […]
        },
        […]
}

Request parameters - required

key string
Your registered API key
bbox csv string of longitude/latitudes: w,s,e,n
A bounding box string as w,s,e,n in which the lines intersect.
boundary GeoJSON fragment string, as [[lon1,lat1],[lon2,lat2],…,[lon1,lat1]]
A boundary string as geojson-style polygonal coordinates of longitude,latitude that enclose or overlap the results.

The bbox and boundary parameters are mutually exclusive.

Request parameters - optional

groupyears 1|0, default 0
Group data for years; e.g.:
0 has separate keys for each year: cycles_00: "1126", cycles_01: "1166", […]
1 (as per the example above) groups this as: cycles: "1126,1166,[…]"

Response

GeoJSON feature list as per example above. Geometry types will always be LineString.

(See GeoJSON example above.)

Error response

JSON object containing an error key and a text string.

Example errors (text string will vary):

{
    "error": "No bbox parameter was supplied."
}

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

My comments relate to: *






Your comments: *
URL of page: * https://birmingham.cyclestreets.net/api/v2/trafficcounts.locations/
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.