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