Contents:
This API call creates a batch matrix job, setting the parameters for a job which can then be started/controlled.
It is the API equivalent to the batch routing system UI.
When a job has been successfully created, it can then be controlled, e.g. started and stopped, using the batchroutes.controljob API call.
When you have planned a job and retrieved its data, you are expected to delete it using the batchroutes.deletejob API call. Any jobs left on the system three months after creation are subject to deletion without notice.
Example which creates a batch job to plan a matrix of routes between a set of specified points, in both directions.
POST https://api.cyclestreets.net/v2/batchroutes.createjob?key=... ( [name] => Journey matrix for Cambridge [serverId] => 1 [geometry] => {"type": "FeatureCollection", "features": [ {"type": "Feature", "id": 1, "properties": {}, "geometry": {"type": "Point", "coordinates": [0.14187, 52.20303]}}, {"type": "Feature", "id": "a", "properties": {}, "geometry": {"type": "Point", "coordinates": [0.14711, 52.20061]}}, {"type": "Feature", "id": 56, "properties": {}, "geometry": {"type": "Point", "coordinates": [0.11638, 52.20360]}}, [...] ]} [strategies] => fastest,quietest [bothDirections] => 1 [minDistance] => 50 [maxDistance] => 5000 [filename] => cambridge [includeJsonOutput] => 1 [emailOnCompletion] => webmaster@example.com [autostart] => 1 [username] => myusername [password] => mypassword )
Result:
{ "id": 69158, "status": "open", "statusUrl": "https://api.cyclestreets.net/v2/batchroutes.jobdata?key=..." }
GeoJSON string, containing either:
* For (1) and (2), there must be an 'id' property for each feature, either in the properties or at the top level; if both present, top-level will dominate.
The maximum permitted size of the data is 64MB. To avoid unnecessarily bulky data, we recommend you ensure that there are no extraneous properties being submitted and that you trim co-ordinates to 5 decimal places, which gives ~1m resolution.
Note: The batch routing system UI provides a range of other options. These are not yet supported here, but if you particularly require one/some option(s), please do get in touch and we can expedite adding it/them.
As shown in the example above, returns the job ID, and the status.
If not autostarted, the job ID can be used to start the job with batchroutes.controljob.
JSON object containing an error key and a text string.
Example error (text string will vary):
{ "error": "An error occurred while creating the job." }
{ "error": "The submitted geometry is too large. The maximum permitted size is 64MB. The data you submitted is 66.7MB. (You may wish to check you are avoiding sending unnecessarily bulky data. We recommend you ensure that in the geometry data there are no extraneous properties being submitted and that you trim co-ordinates to 5 decimal places, which gives ~1m resolution.)" }