Contents:
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 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 } } }
JSON structure as per examples above, with features nested by type, except when a type is specified.
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." }