Donate using PayPal

CycleStreets API (v2)

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

Infrastructure schema

This call returns the schema of an infrastructure dataset.

This is intended to enable a GUI to generate a form structure and validation schema dynamically.

Example

Example which retrieves the schema for a dataset.

https://api.cyclestreets.net/v2/infrastructure.schema?dataset=tflcid

Result:

{
    "advanced_stop_line": {
        "id": "advanced_stop_line",
        "name": "Advanced Stop Line",
        "geometrytype": "LineString",
        "description": "Advance stop lines (ASL) located at traffic signals provide an area for cyclists to wait for the traffic signals to change ahead of general traffic.",
        "iconUrl": "https://www.example.com/images/icons/line.svg",
        "fields": {
            "asl_feeder_lane": {
                "fieldname": "asl_feeder_lane",
                "field": "Feeder lane",
                "description": "Whether a feeder lane is present",
                "datatype": "ENUM('TRUE','FALSE')",
                "combine": null,
                "combineLabel": null,
                "documentationUrl": "https://www.example.com/doc/asl_feeder_lane.pdf"
            },
            "asl_length": {
                "fieldname": "asl_length",
                "field": "Length in metres",
                "description": "Length of the ASL in front of the traffic light",
                "datatype": "ENUM('TRUE','FALSE')",
                "combine": null,
                "combineLabel": null,
                "documentationUrl": null
            },
            "asl_lane_left": {
                "fieldname": "asl_lane_left",
                "field": "ASL left lane",
                "description": "ASL lane is on the left",
                "datatype": "ENUM('TRUE','FALSE')",
                "combine": "location",
                "combineLabel": "Lane location",
                "documentationUrl": null
            },
            "asl_lane_right": {
                "fieldname": "asl_lane_right",
                "field": "ASL right lane",
                "description": "ASL lane is on the right",
                "datatype": "ENUM('TRUE','FALSE')",
                "combine": "location",
                "combineLabel": "Lane location",
                "documentationUrl": null
            }
        }
    },
    "crossing": {
        "id": "crossing",
        "name": "Crossing",
        "geometrytype": "LineString",
        "description": "Crossings intended to be used by cyclists.",
        "iconUrl": "https://www.example.com/images/icons/path.svg",
        "fields": {
            "crossing_colour": {
                "fieldname": "colour",
                "field": "Surface colour",
                "description": "Colour of lane/track or ASL",
                "datatype": "ENUM('None','Green','Red','Yellow','Blue','Other')",
                "combine": null,
                "combineLabel": null,
                "documentationUrl": null
            },
            "crossing_gap": {
                "fieldname": "crossing_gap",
                "field": "Cycle gap",
                "description": "True = crossing includes gap in island or kerb allowing cyclists only",
                "datatype": "ENUM('TRUE','FALSE')",
                "combine": null,
                "combineLabel": null,
                "documentationUrl": null
            }
        }
    }
}

Example which retrieves the schema for a dataset, but limited to a specified type. Note that the data is therefore no longer nested by type.

https://api.cyclestreets.net/v2/infrastructure.schema?dataset=tflcid&type=crossing

Result:

{
    "id": "crossing",
    "name": "Crossing",
    "geometrytype": "LineString",
    "description": "Crossings intended to be used by cyclists.",
    "iconUrl": "https://www.example.com/images/icons/path.svg",
    "fields": {
        "crossing_colour": {
            "fieldname": "colour",
            "field": "Surface colour",
            "description": "Colour of lane/track or ASL",
            "datatype": "ENUM('None','Green','Red','Yellow','Blue','Other')",
            "combine": null,
            "combineLabel": null
        },
        "crossing_gap": {
            "fieldname": "crossing_gap",
            "field": "Cycle gap",
            "description": "True = crossing includes gap in island or kerb allowing cyclists only",
            "datatype": "ENUM('TRUE','FALSE')",
            "combine": null,
            "combineLabel": null
        }
    }
}

Request parameters - required

dataset string
Dataset name.
Currently-supported public values are: tflcid.

Request parameters - optional

type string
Feature type. Note that the presence of this field will cause the data not to be nested by type, as per the second example above.

Response

JSON structure as per examples above, with features nested by type, except when a type is specified.

Error response

JSON object containing an error key and a text string.

Example errors (text string may vary):

{
    "error": "No dataset was supplied."
}
{
    "error": "Invalid dataset."
}
{
    "error": "Invalid type."
}

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

My comments relate to: *






Your comments: *
URL of page: * https://cambridge.cyclestreets.net/api/v2/infrastructure.schema/
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.