(fr) Cette page n’est plus maintenue depuis la version 2022 de Geoconcept Web. Pour accéder à la documentation à jour de ce web service, veuillez suivre ce lien.
This web service calculates an itinerary between two points and returns a full route sheet. Adding intermediate steps is an option for the user, in the context of the configured graph or network, the name of which has been specified in the interface.
Earlier versions of the web service are conserved in Geoconcept Web to ensure compatibility with earlier software developments. We reommend using the most recent version.
Changes in relation to v6
- Addition of the "formatItems" and "fields" parameters.
Changes in relation to v5
- Addition of the "maxCost", "timeOut" and "computeOptions" parameters.
- Addition to the "nodes" snapMethod of snap to the nearest nodes.
- "compressedgeometry" and "compressedsimplifiedgeometry" formats have been added, with utilization of the encoded polyline compression algorithm (Encoded Polyline Algorithm Format) enabling storage of coordinates in a single ASCII character string, thereby significantly reducing overall data volumes.
- Addition of the "tollcost" format, requires an access license to the HERE platform.
Changes in relation to v4
- Addition of the notion of node, faster, to snap to graph nodes rather than to geographic coordinates. Addition of the following elements: "originNode", "destinationNode", "waypointNodes", "node" in the format parameter and "nodes" in the snapMethod parameter.
- Addition in the response of the following items: "originNode", "destinationNode", "waypointNodes" and "carbonFootprint".
- Addition of the "avoidArea" and "configName" parameters.
Changes in relation to v3
- Addition of the "snapMethod" parameter
- Deletion of the "projection" parameter, replaced by "srs"
- Deletion of the "RejectFlags" parameter, replaced by "exclusions"
- Change in the parameter type for the "distanceMeters" and "durationSeconds" parameters from String/Double to Double
- The "geometryWkt" and "simplifiedWkt" parameters have been renamed "wktGeometry" and "wktSimplifiedGeometry" respectively
- The "navInstruvtion" parameter has been renamed "navigationInstruction"
- In RouteResultV3, addition of the "srs" parameter
- The "elapsedTimeSeconds" parameter has been renamed "durationSeconds" and its type has been changed from String to Double
- The "coordinates" parameter has been renamed "location"
Changes in relation to V2
- Addition of the "timeLine" parameter
- Deletion of the "map" and "applyMapPrecisionOut" parameters
- The "distance" and "duration" parameters have been renamed "distanceMeters" and "durationSeconds" respectivly
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
originNode |
Start node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
destination |
Finish point coordinates. |
no |
|
destinationNode |
Arrival node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
waypoints |
Coordinates for route stops. |
yes |
|
waypointNodes |
Step nodes. |
yes * |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName (depreciated) |
Name of the graph to use |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) Example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start date of 21 January 2014, at 9.00am in Paris. Caution: the + character can be misinterpreted by browsers, so in this case, it should be replaced by %2B. |
yes |
|
profileId (depreciated) |
Vehicle identifier (saved under vehicle profiles) |
yes |
|
profileName (depreciated) |
Vehicle profile (saved in the vehicle profiles) |
yes |
|
exclusions |
List of restriction rules to use, separated by the ; character (Example: Toll, Tunnel, Bridge) |
yes |
|
timeLine |
List of intermediate durations to calculate positions along the route trajectory. Expressed in seconds, separated by the ; character. The returned position corresponds to the previous node, on the path, connectable to the network. For example, on a highway, the returned position is the last exit or service area before the requested position. |
yes |
|
snapMethod |
Snap to graph method |
yes |
standard |
avoidArea |
Forbidden transit zone in WKT format (POLYGON or MULTIPOLYGON) in the requested projection (srs parameter) |
yes |
|
configName |
Name of the configuration to use (defined in Geoconcept Web - Administration / Tools / Road graphs) |
yes |
|
computeOptions |
List of options for the calculation,separated by ; characters |
yes |
|
maxCost |
Maximum cost not to exceed in the calculation |
yes |
|
timeOut |
Time out for the calculation (in milliseconds) |
yes |
|
formatItems |
List of available format items, if the format parameter is set to custom |
yes |
|
fields |
List of fields to be displayed as a result of each segment (for the standard and extended _formats)
- Iso country code |
yes |
(M18) Available from version M18 and later versions of graphs supplied by GEOCONCEPT SAS.
Output
Route (routeResultV6)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Total route distance in metres. |
durationSeconds |
double |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
wktGeometry |
string |
0/1 |
Geometry of the route in WKT format |
wktSimplified |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRouteV5 (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timeLineItemV5 (or an array in JSON / JSON-P) |
0/unlimited |
List of calculated positions. |
srs |
string |
0/1 |
projection passed as input (EPSG code such as epsg:4326 or wgs84) |
originNode |
string |
0/1 |
Start node identifier (entered if format=NODE). |
destinationNode |
string |
0/1 |
Arrival node identifier (entered if format=NODE). |
waypointNodes |
waypointNodes array (string) |
0/unlimited |
Step nodes identifiers (entered if format=NODE). |
carbonFootprint |
double |
0/1 |
Carbon footprint (CO2 emissions in kilograms) |
tollCost |
Array de tollCost |
0/unlimited |
Toll cost information (filled in if format=tollCost). |
fieldsNames |
Array de fields |
0/unlimited |
list of requested fields with the parameter field. |
Route section (subRouteV6)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segmentV5 (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segmentV6)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
Route position (timeLineItemV6)
parameter | type | min/max | description |
---|---|---|---|
durationSeconds |
double |
0/1 |
Route duration in seconds up to this position. |
message |
string |
0/1 |
Error message for this position. |
status |
string |
0/1 |
Status of this position. |
distanceMeters |
double |
0/1 |
Distance of the route in metres up to this position. |
location |
string |
0/1 |
Coordinates of the position. |
TollCost (tollCost)
parameter | type | min/max | description |
---|---|---|---|
amount |
double |
0/1 |
Total cost of tolls. |
currency |
string |
0/1 |
Currency. |
costsByCountry |
Array de costsByCountry |
0/unlimited |
List of toll costs by country. |
Cost of tolls per country (costsByCountry)
parameter | type | min/max | description |
---|---|---|---|
amount |
double |
0/1 |
Cost of tolls. |
country |
string |
0/1 |
Country code (3-letter ISO country code). |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:routeV6> <!--Optional:--> <request> <origin> <x>-1.351448</x> <y>47.446923</y> </origin> <!--Optional:--> <originNode></originNode> <destination> <x>-1.34529</x> <y>47.4479931</y> </destination> <!--Optional:--> <destinationNode></destinationNode> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>-1.34981</x> <y>47.44837</y> </waypoint> </waypoints> <!--Optional:--> <waypointNodes> <!--Zero or more repetitions:--> <waypointNode></waypointNode> </waypointNodes> <!--Optional:--> <srs>epsg:4326</srs> <!--Optional:--> <method>time</method> <!--Optional:--> <format>STANDARD</format> <!--Optional:--> <tolerance>0.</tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime></startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> <!--Optional:--> <timeLine> <!--Zero or more repetitions:--> <timeLineItem></timeLineItem> </timeLine> <!--Optional:--> <snapMethod></snapMethod> <!--Optional:--> <avoidArea></avoidArea> <!--Optional:--> <computeOptions></computeOptions> <!--Optional:--> <timeOut></timeOut> <!--Optional:--> <configName></configName> </request> </sch:routeV6> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeV6Response xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.97</distanceMeters> <durationSeconds>126.88</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] , -1.34529 47.447993)</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] , -1.34529 47.447993)</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.1</distanceMeters> <durationSeconds>46.28</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.28</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> <distance>91 m</distance> <duration>0:00:16</duration> <distanceMeters>91.33</distanceMeters> <durationSeconds>16.43</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DES SAULES</name> </step> <step> <distance>3 m</distance> <duration>0:00:00</duration> <distanceMeters>3.18</distanceMeters> <durationSeconds>0.57</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name /> </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.87</distanceMeters> <durationSeconds>80.6</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.64</distanceMeters> <durationSeconds>3.17</durationSeconds> <name /> </step> <step> <distance>67 m</distance> <duration>0:00:15</duration> <distanceMeters>66.62</distanceMeters> <durationSeconds>15.05</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DES FOURS</name> </step> <step> <distance>36 m</distance> <duration>0:00:08</duration> <distanceMeters>35.74</distanceMeters> <durationSeconds>8.57</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>PLACE DE L'ÉGLISE</name> </step> <step> <distance>72 m</distance> <duration>0:00:15</duration> <distanceMeters>72.25</distanceMeters> <durationSeconds>15.24</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>RUE DES PRESSOIRS</name> </step> <step> <distance>26 m</distance> <duration>0:00:04</duration> <distanceMeters>26.02</distanceMeters> <durationSeconds>4.68</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name /> </step> <step> <distance>183 m</distance> <duration>0:00:32</duration> <distanceMeters>182.84</distanceMeters> <durationSeconds>32.91</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DU BOURG DRAPÉ</name> </step> <step> <distance>6 m</distance> <duration>0:00:00</duration> <distanceMeters>5.76</distanceMeters> <durationSeconds>0.98</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DE LA CURE</name> </step> </leg> <srs>epsg:4326</srs> <carbonFootprint>0.0</carbonFootprint> </RouteResult> </ns2:routeV6Response> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route/v6.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
JSON-P query
http://<server>/<webapp>/api/lbs/route/v6.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route/v6.xml?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
Response
The response is always in UTF-8 format.
JSON format
{ "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 }
JSON-P format
myCallback( { "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 } );
XML format
<?xml version="1.0" encoding="UTF-8"?> <routeResultV6> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV6>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route/v5.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResultV6/status is OK)
<?xml version="1.0" encoding="UTF-8"?> <routeResultV6> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV6>
Case of a forgotten specification of a start or finish point (routeResultV6/status is ERROR)
<routeResultV6> <message>Origin and destination must be not null</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV6>
Case of a forgotten specification of a start or finish point (routeResultV6/status is ERROR)
<routeResultV6> <message>Origin, destination and waypoints should be represented by a couple of coordinates</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV6>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 146.691012, 47.384813, 0.000000 } failed to connect waypoint { 146.691012, 47.384813, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
originNode |
Start node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
destination |
Finish point coordinates. |
no |
|
destinationNode |
Arrival node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
waypoints |
Coordinates for route stops. |
yes |
|
waypointNodes |
Step nodes. |
yes * |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName (depreciated) |
Name of the graph to use |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) Example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start date of 21 January 2014, at 9.00am in Paris. Caution: the + character can be misinterpreted by browsers, so in this case, it should be replaced by %2B. |
yes |
|
profileId (depreciated) |
Vehicle identifier (saved under vehicle profiles) |
yes |
|
profileName (depreciated) |
Vehicle profile (saved in the vehicle profiles) |
yes |
|
exclusions |
List of restriction rules to use, separated by the ; character (Example: Toll, Tunnel, Bridge) |
yes |
|
timeLine |
List of intermediate durations to calculate positions along the route trajectory. Expressed in seconds, separated by the ; character. The returned position corresponds to the previous node, on the path, connectable to the network. For example, on a highway, the returned position is the last exit or service area before the requested position. |
yes |
|
snapMethod |
Snap to graph method |
yes |
standard |
avoidArea |
Forbidden transit zone in WKT format (POLYGON or MULTIPOLYGON) in the requested projection (srs parameter) |
yes |
|
configName |
Name of the configuration to use (defined in Geoconcept Web - Administration / Tools / Road graphs) |
yes |
|
computeOptions |
List of options for the calculation,separated by ; characters |
yes |
|
maxCost |
Maximum cost not to exceed in the calculation |
yes |
|
timeOut |
Time out for the calculation (in milliseconds) |
yes |
(M18) Available from version M18 and later versions of graphs supplied by GEOCONCEPT SAS.
Output
Route (routeResultV5)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Total route distance in metres. |
durationSeconds |
double |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
wktGeometry |
string |
0/1 |
Geometry of the route in WKT format |
wktSimplified |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRouteV5 (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timeLineItemV5 (or an array in JSON / JSON-P) |
0/unlimited |
List of calculated positions. |
srs |
string |
0/1 |
projection passed as input (EPSG code such as epsg:4326 or wgs84) |
originNode |
string |
0/1 |
Start node identifier (entered if format=NODE). |
destinationNode |
string |
0/1 |
Arrival node identifier (entered if format=NODE). |
waypointNodes |
waypointNodes array (string) |
0/unlimited |
Step nodes identifiers (entered if format=NODE). |
carbonFootprint |
double |
0/1 |
Carbon footprint (CO2 emissions in kilograms) |
tollCost |
Array de tollCost |
0/unlimited |
Toll cost information (filled in if format=tollCost). |
Itinerary portion (subRouteV5)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segmentV5 (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segmentV5)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
Route position (timeLineItemV5)
parameter | type | min/max | description |
---|---|---|---|
durationSeconds |
double |
0/1 |
Route duration in seconds up to this position. |
message |
string |
0/1 |
Error message for this position. |
status |
string |
0/1 |
Status of this position. |
distanceMeters |
double |
0/1 |
Distance of the route in metres up to this position. |
location |
string |
0/1 |
Coordinates of the position. |
TollCost (tollCost)
parameter | type | min/max | description |
---|---|---|---|
amount |
double |
0/1 |
Total cost of tolls. |
currency |
string |
0/1 |
Currency. |
costsByCountry |
Array de costsByCountry |
0/unlimited |
List of toll costs by country. |
Cost of tolls per country (costsByCountry)
parameter | type | min/max | description |
---|---|---|---|
amount |
double |
0/1 |
Cost of tolls. |
country |
string |
0/1 |
Country code (3-letter ISO country code). |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:routeV5> <!--Optional:--> <request> <origin> <x>-1.351448</x> <y>47.446923</y> </origin> <!--Optional:--> <originNode></originNode> <destination> <x>-1.34529</x> <y>47.4479931</y> </destination> <!--Optional:--> <destinationNode></destinationNode> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>-1.34981</x> <y>47.44837</y> </waypoint> </waypoints> <!--Optional:--> <waypointNodes> <!--Zero or more repetitions:--> <waypointNode></waypointNode> </waypointNodes> <!--Optional:--> <srs>epsg:4326</srs> <!--Optional:--> <method>time</method> <!--Optional:--> <format>STANDARD</format> <!--Optional:--> <tolerance>0.</tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime></startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> <!--Optional:--> <timeLine> <!--Zero or more repetitions:--> <timeLineItem></timeLineItem> </timeLine> <!--Optional:--> <snapMethod></snapMethod> <!--Optional:--> <avoidArea></avoidArea> <!--Optional:--> <computeOptions></computeOptions> <!--Optional:--> <timeOut></timeOut> <!--Optional:--> <configName></configName> </request> </sch:routeV5> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeV5Response xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.97</distanceMeters> <durationSeconds>126.88</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] , -1.34529 47.447993)</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] , -1.34529 47.447993)</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.1</distanceMeters> <durationSeconds>46.28</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.28</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> <distance>91 m</distance> <duration>0:00:16</duration> <distanceMeters>91.33</distanceMeters> <durationSeconds>16.43</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DES SAULES</name> </step> <step> <distance>3 m</distance> <duration>0:00:00</duration> <distanceMeters>3.18</distanceMeters> <durationSeconds>0.57</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name /> </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.87</distanceMeters> <durationSeconds>80.6</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.64</distanceMeters> <durationSeconds>3.17</durationSeconds> <name /> </step> <step> <distance>67 m</distance> <duration>0:00:15</duration> <distanceMeters>66.62</distanceMeters> <durationSeconds>15.05</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DES FOURS</name> </step> <step> <distance>36 m</distance> <duration>0:00:08</duration> <distanceMeters>35.74</distanceMeters> <durationSeconds>8.57</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>PLACE DE L'ÉGLISE</name> </step> <step> <distance>72 m</distance> <duration>0:00:15</duration> <distanceMeters>72.25</distanceMeters> <durationSeconds>15.24</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>RUE DES PRESSOIRS</name> </step> <step> <distance>26 m</distance> <duration>0:00:04</duration> <distanceMeters>26.02</distanceMeters> <durationSeconds>4.68</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name /> </step> <step> <distance>183 m</distance> <duration>0:00:32</duration> <distanceMeters>182.84</distanceMeters> <durationSeconds>32.91</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DU BOURG DRAPÉ</name> </step> <step> <distance>6 m</distance> <duration>0:00:00</duration> <distanceMeters>5.76</distanceMeters> <durationSeconds>0.98</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DE LA CURE</name> </step> </leg> <srs>epsg:4326</srs> <carbonFootprint>0.0</carbonFootprint> </RouteResult> </ns2:routeV5Response> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route/v5.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
JSON-P query
http://<server>/<webapp>/api/lbs/route/v5.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route/v5.xml?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
Response
The response is always in UTF-8 format.
JSON format
{ "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 }
JSON-P format
myCallback( { "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 } );
XML format
<?xml version="1.0" encoding="UTF-8"?> <routeResultV5> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV5>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route/v5.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResultV5/status is OK)
<?xml version="1.0" encoding="UTF-8"?> <routeResultV5> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV5>
Case of a forgotten specification of a start or finish point (routeResultV5/status is ERROR)
<routeResultV5> <message>Origin and destination must be not null</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV5>
Case of a faulty format assigned to the start or finish point or to route stops (routeResultV5/status is ERROR)
<routeResultV5> <message>Origin, destination and waypoints should be represented by a couple of coordinates</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV5>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 146.691012, 47.384813, 0.000000 } failed to connect waypoint { 146.691012, 47.384813, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
originNode |
Start node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
destination |
Finish point coordinates. |
no |
|
destinationNode |
Arrival node. Care: a physical node does not have the same ID in another graph. |
yes * |
|
waypoints |
Coordinates for route stops. |
yes |
|
waypointNodes |
Step nodes. |
yes * |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName |
Name of the graph to use |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) Example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start date of 21 January 2014, at 9.00am in Paris. Caution: the + character can be misinterpreted by browsers, so in this case, it should be replaced by %2B. |
yes |
|
profileId |
Vehicle identifier (saved under vehicle profiles) |
yes |
|
profileName |
Vehicle profile (saved in the vehicle profiles) |
yes |
|
exclusions |
List of restriction rules to use, separated by the , or ; character (Example: Toll, Tunnel, Bridge) |
yes |
|
timeLine |
List of intermediate durations to calculate positions along the route trajectory. Expressed in seconds, separated by the ; character |
yes |
|
snapMethod |
Snap to graph method |
yes |
standard |
avoidArea |
Forbidden transit zone in WKT format (POLYGON or MULTIPOLYGON) in the requested projection (srs parameter) |
yes |
|
configName |
Name of the configuration to use (defined in Geoconcept Web - Administration / Tools / Road graphs) |
yes |
Output
Route (routeResultV4)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Total route distance in metres. |
durationSeconds |
double |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
wktGeometry |
string |
0/1 |
Geometry of the route in WKT format |
wktSimplified |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRouteV4 (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timeLineItemV4 (or an array in JSON / JSON-P) |
0/unlimited |
List of calculated positions. |
srs |
string |
0/1 |
projection passed as input (EPSG code such as epsg:4326 or wgs84) |
originNode |
string |
0/1 |
Start node identifier (entered if format=NODE). |
destinationNode |
string |
0/1 |
Arrival node identifier (entered if format=NODE). |
waypointNodes |
waypointNodes array (string) |
0/unlimited |
Step nodes identifiers (entered if format=NODE). |
carbonFootprint |
double |
0/1 |
Carbon footprint (CO2 emissions in kilograms) |
Itinerary portion (subRouteV4)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segmentV4 (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segmentV4)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
Route position (timeLineItemV4)
parameter | type | min/max | description |
---|---|---|---|
durationSeconds |
double |
0/1 |
Route duration in seconds up to this position. |
message |
string |
0/1 |
Error message for this position. |
status |
string |
0/1 |
Status of this position. |
distanceMeters |
double |
0/1 |
Distance of the route in metres up to this position. |
location |
string |
0/1 |
Coordinates of the position. |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:routeV4> <!--Optional:--> <request> <origin> <x>-1.351448</x> <y>47.446923</y> </origin> <!--Optional:--> <originNode></originNode> <destination> <x>-1.34529</x> <y>47.4479931</y> </destination> <!--Optional:--> <destinationNode></destinationNode> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>-1.34981</x> <y>47.44837</y> </waypoint> </waypoints> <!--Optional:--> <waypointNodes> <!--Zero or more repetitions:--> <waypointNode></waypointNode> </waypointNodes> <!--Optional:--> <srs>epsg:4326</srs> <!--Optional:--> <method>time</method> <!--Optional:--> <format>STANDARD</format> <!--Optional:--> <tolerance>0.</tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime></startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> <!--Optional:--> <timeLine> <!--Zero or more repetitions:--> <timeLineItem></timeLineItem> </timeLine> <!--Optional:--> <snapMethod></snapMethod> <!--Optional:--> <avoidArea></avoidArea> <!--Optional:--> <configName></configName> </request> </sch:routeV4> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeV4Response xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>126.88</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] )</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] )</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.28</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.28</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> <distance>91 m</distance> <duration>0:00:16</duration> <distanceMeters>91.33</distanceMeters> <durationSeconds>16.43</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DES SAULES</name> </step> <step> <distance>3 m</distance> <duration>0:00:00</duration> <distanceMeters>3.17</distanceMeters> <durationSeconds>0.57</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name/> </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>80.6</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.17</durationSeconds> <name/> </step> <step> <distance>67 m</distance> <duration>0:00:15</duration> <distanceMeters>66.62</distanceMeters> <durationSeconds>15.05</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DES FOURS</name> </step> <step> <distance>36 m</distance> <duration>0:00:08</duration> <distanceMeters>35.74</distanceMeters> <durationSeconds>8.57</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>PLACE DE L'ÉGLISE</name> </step> <step> <distance>72 m</distance> <duration>0:00:15</duration> <distanceMeters>72.25</distanceMeters> <durationSeconds>15.24</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>RUE DES PRESSOIRS</name> </step> <step> <distance>26 m</distance> <duration>0:00:04</duration> <distanceMeters>26.02</distanceMeters> <durationSeconds>4.68</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name/> </step> <step> <distance>183 m</distance> <duration>0:00:32</duration> <distanceMeters>182.84</distanceMeters> <durationSeconds>32.91</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DU BOURG DRAPÉ</name> </step> <step> <distance>6 m</distance> <duration>0:00:00</duration> <distanceMeters>5.76</distanceMeters> <durationSeconds>0.98</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DE LA CURE</name> </step> </leg> <timeLineItem> <durationSeconds>0.0</durationSeconds> <status>OK</status> <distanceMeters>0.0</distanceMeters> <location>-1.351448,47.446923</location> </timeLineItem> <srs>epsg:4326</srs> <carbonFootprint>0.0</carbonFootprint> </RouteResult> </ns2:routeV4Response> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route/v4.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
JSON-P query
http://<server>/<webapp>/api/lbs/route/v4.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route/v4.xml?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
Response
The response is always in UTF-8 format.
JSON format
{ "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 }
JSON-P format
myCallback( { "message": null, "status": "OK", "distance": "640 m", "duration": "0:02:09", "distanceMeters": 639.95, "durationSeconds": 129.48, "bounds": "-1.351448,47.446922;-1.345263,47.44848", "wktGeometry": "LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs": [ { "distance": "233 m", "duration": "0:00:46", "distanceMeters": 233.09, "durationSeconds": 46.84, "steps": [ { "distance": "139 m", "duration": "0:00:29", "distanceMeters": 138.59, "durationSeconds": 29.83, "navigationInstruction": null, "name": "RUE LA FONTAINE BRUNEAU", "points": [] }, { [...] } ] }, { "distance": "407 m", "duration": "0:01:22", "distanceMeters": 406.86, "durationSeconds": 82.64, "steps": [ { "distance": "18 m", "duration": "0:00:03", "distanceMeters": 17.63, "durationSeconds": 3.18, "navigationInstruction": null, "name": "", "points": [] }, { [...] } ] } ], "startDateTime": null, "finishDateTime": null, "srs": null, "originNode": null, "waypointNodes": null, "destinationNode": null, "carbonFootprint": 0.195038864105688 } );
XML format
<?xml version="1.0" encoding="UTF-8"?> <routeResultV4> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV4>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route/v4.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResultV4/status is OK)
<?xml version="1.0" encoding="UTF-8"?> <routeResultV4> <status>OK</status> <distance>640 m</distance> <duration>0:02:09</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>129.48</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.84</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:22</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>82.64</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.18</durationSeconds> <name /> </step> <step> [...] </step> </leg> <carbonFootprint>0.195038864105688</carbonFootprint> </routeResultV4>
Case of a forgotten specification of a start or finish point (routeResultV4/status is ERROR)
<routeResultV4> <message>Origin and destination must be not null</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV4>
Case of a faulty format assigned to the start or finish point or to route stops (routeResultV4/status is ERROR)
<routeResultV4> <message>Origin, destination and waypoints should be represented by a couple of coordinates</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV4>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 146.691012, 47.384813, 0.000000 } failed to connect waypoint { 146.691012, 47.384813, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
destination |
Finish point coordinates. |
no |
|
waypoints |
Coordinates for route stops. |
yes |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName |
Name of the graph to use |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start on 21 January 2014, at 9.00am in Paris |
yes |
|
profileId |
Vehicle identifier (saved under vehicle profiles) to use |
yes |
|
profileName |
Vehicle profile (saved under vehicle profiles) to use |
yes |
|
exclusions |
List of restriction rules to use, separated by the , or ; character (Example: Toll, Tunnel, Bridge) |
yes |
|
timeLine |
List of intermediate durations to calculate positions along the route trajectory. Expressed in seconds, separated by the ; character |
yes |
|
snapMethod |
Snap to graph method |
yes |
standard |
Output
Route (routeResultV3)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Total route distance in metres. |
durationSeconds |
double |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
wktGeometry |
string |
0/1 |
Geometry of the route in WKT format |
wktSimplified |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRouteV3 (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timeLineItemV3 (or an array in JSON / JSON-P) |
0/unlimited |
List of calculated positions. |
srs |
string |
0/1 |
projection passed as input (EPSG code such as epsg:4326 or wgs84) |
Route subsection (SubRouteV3)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segmentV3 (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segmentV3)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
double |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
double |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
Route position (timeLineItemV3)
parameter | type | min/max | description |
---|---|---|---|
durationSeconds |
double |
0/1 |
Route duration in seconds up to this position. |
message |
string |
0/1 |
Error message for this position. |
status |
string |
0/1 |
Status of this position. |
distanceMeters |
double |
0/1 |
Distance of the route in metres up to this position. |
location |
string |
0/1 |
Coordinates of the position. |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:routeV3> <!--Optional:--> <request> <origin> <x>-1.351448</x> <y>47.446923</y> </origin> <destination> <x>-1.34529</x> <y>47.4479931</y> </destination> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>-1.34981</x> <y>47.44837</y> </waypoint> </waypoints> <!--Optional:--> <srs>epsg:4326</srs> <!--Optional:--> <method>time</method> <!--Optional:--> <format>STANDARD</format> <!--Optional:--> <tolerance>0.</tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime>2015-07-29T09:00:00.000+01:00</startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> <!--Optional:--> <timeLine> <!--Zero or more repetitions:--> <timeLineItem>5</timeLineItem> <timeLineItem>15</timeLineItem> </timeLine> <!--Optional:--> <snapMethod></snapMethod> </request> </sch:routeV3> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeV3Response xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.95</distanceMeters> <durationSeconds>126.88</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] )</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, [...] )</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.28</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.28</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> <distance>91 m</distance> <duration>0:00:16</duration> <distanceMeters>91.33</distanceMeters> <durationSeconds>16.43</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DES SAULES</name> </step> <step> <distance>3 m</distance> <duration>0:00:00</duration> <distanceMeters>3.17</distanceMeters> <durationSeconds>0.57</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name/> </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.86</distanceMeters> <durationSeconds>80.6</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.17</durationSeconds> <name/> </step> <step> <distance>67 m</distance> <duration>0:00:15</duration> <distanceMeters>66.62</distanceMeters> <durationSeconds>15.05</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DES FOURS</name> </step> <step> <distance>36 m</distance> <duration>0:00:08</duration> <distanceMeters>35.74</distanceMeters> <durationSeconds>8.57</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>PLACE DE L'ÉGLISE</name> </step> <step> <distance>72 m</distance> <duration>0:00:15</duration> <distanceMeters>72.25</distanceMeters> <durationSeconds>15.24</durationSeconds> <navigationInstruction>F</navigationInstruction> <name>RUE DES PRESSOIRS</name> </step> <step> <distance>26 m</distance> <duration>0:00:04</duration> <distanceMeters>26.02</distanceMeters> <durationSeconds>4.68</durationSeconds> <navigationInstruction>round_about_entry</navigationInstruction> <name/> </step> <step> <distance>183 m</distance> <duration>0:00:32</duration> <distanceMeters>182.84</distanceMeters> <durationSeconds>32.91</durationSeconds> <navigationInstruction>round_about_exit</navigationInstruction> <name>RUE DU BOURG DRAPÉ</name> </step> <step> <distance>6 m</distance> <duration>0:00:00</duration> <distanceMeters>5.76</distanceMeters> <durationSeconds>0.98</durationSeconds> <navigationInstruction>FR</navigationInstruction> <name>RUE DE LA CURE</name> </step> </leg> <startDateTime>2015-07-29T10:00:00.000+02:00</startDateTime> <finishDateTime>2015-07-29T10:02:06.880+02:00</finishDateTime> <timeLineItem> <durationSeconds>5.0</durationSeconds> <status>OK</status> <distanceMeters>23.66</distanceMeters> <location>-1.35137,47.447123</location> </timeLineItem> <timeLineItem> <durationSeconds>15.0</durationSeconds> <status>OK</status> <distanceMeters>71.0</distanceMeters> <location>-1.351204,47.447533</location> </timeLineItem> <srs>epsg:4326</srs> </RouteResult> </ns2:routeV3Response> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route/v3.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
JSON-P query
http://<server>/<webapp>/api/lbs/route/v3.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route/v3.xml?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
Response
The response is always in UTF-8 format.
JSON format
{ "message":null, "status":"OK", "distance":"640 m", "duration":"0:01:25", "distanceMeters":640.0, "durationSeconds":85.64, "bounds":"-1.351448,47.446922;-1.345263,47.44848", "wktGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs":[ { "distance":"233 m", "duration":"0:00:36", "distanceMeters":233.1, "durationSeconds":36.33, "steps":[ { "distance":"139 m", "duration":"0:00:25", "distanceMeters":138.59, "durationSeconds":25.0, "navigationInstruction":null, "name":"RUE LA FONTAINE BRUNEAU", "points":[ ] }, { [...] } ] }, { "distance":"407 m", "duration":"0:00:49", "distanceMeters":406.90000000000003, "durationSeconds":49.31, "steps":[ { "distance":"18 m", "duration":"0:00:02", "distanceMeters":17.62, "durationSeconds":2.11, "navigationInstruction":null, "name":"", "points":[ ] }, { [...] } ] } ], "startDateTime":null, "finishDateTime":null, "srs":"epsg:4326" }
JSON-P format
myCallback( { "message":null, "status":"OK", "distance":"640 m", "duration":"0:01:25", "distanceMeters":640.0, "durationSeconds":85.64, "bounds":"-1.351448,47.446922;-1.345263,47.44848", "wktGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "wktSimplifiedGeometry":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs":[ { "distance":"233 m", "duration":"0:00:36", "distanceMeters":233.1, "durationSeconds":36.33, "steps":[ { "distance":"139 m", "duration":"0:00:25", "distanceMeters":138.59, "durationSeconds":25.0, "navigationInstruction":null, "name":"RUE LA FONTAINE BRUNEAU", "points":[ ] }, { [...] } ] }, { "distance":"407 m", "duration":"0:00:49", "distanceMeters":406.90000000000003, "durationSeconds":49.31, "steps":[ { "distance":"18 m", "duration":"0:00:02", "distanceMeters":17.62, "durationSeconds":2.11, "navigationInstruction":null, "name":"", "points":[ ] }, { [...] } ] } ], "startDateTime":null, "finishDateTime":null, "srs":"epsg:4326" } );
XML format
<?xml version="1.0" encoding="UTF-8"?> <routeResultV3> <status>OK</status> <distance>640 m</distance> <duration>0:01:25</duration> <distanceMeters>640.0</distanceMeters> <durationSeconds>85.64</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:36</duration> <distanceMeters>233.1</distanceMeters> <durationSeconds>36.33</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:25</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>25.0</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:00:49</duration> <distanceMeters>406.90000000000003</distanceMeters> <durationSeconds>49.31</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:02</duration> <distanceMeters>17.62</distanceMeters> <durationSeconds>2.11</durationSeconds> <name /> </step> <step> [...] </step> </leg> <srs>epsg:4326</srs> </routeResultV3>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route/v3.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResultV3/status is OK)
<?xml version="1.0" encoding="UTF-8"?> <routeResultV3> <status>OK</status> <distance>640 m</distance> <duration>0:01:25</duration> <distanceMeters>640.0</distanceMeters> <durationSeconds>85.64</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <wktGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktGeometry> <wktSimplifiedGeometry>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</wktSimplifiedGeometry> <leg> <distance>233 m</distance> <duration>0:00:36</duration> <distanceMeters>233.1</distanceMeters> <durationSeconds>36.33</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:25</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>25.0</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:00:49</duration> <distanceMeters>406.90000000000003</distanceMeters> <durationSeconds>49.31</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:02</duration> <distanceMeters>17.62</distanceMeters> <durationSeconds>2.11</durationSeconds> <name /> </step> <step> [...] </step> </leg> <srs>epsg:4326</srs> </routeResultV3>
Case of a forgotten specification of a start or finish point (routeResultV3/status is ERROR)
<routeResultV3> <message>Origin and destination must be not null</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV3>
Case of a faulty format assigned to the start or finish point or to route stops (routeResultV3/status is ERROR)
<routeResultV3> <message>Origin, destination and waypoints should be represented by a couple of coordinates</message> <status>ERROR</status> <distanceMeters>0.0</distanceMeters> <durationSeconds>0.0</durationSeconds> </routeResultV3>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 146.691012, 47.384813, 0.000000 } failed to connect waypoint { 146.691012, 47.384813, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
destination |
Finish point coordinates. |
no |
|
waypoints |
Coordinates for route stops. |
yes |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName |
Name of the graph to use |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start on 21 January 2014, at 9.00am in Paris |
yes |
|
profileId |
Vehicle identifier (saved under vehicle profiles) to use |
yes |
|
profileName |
Vehicle profile (saved under vehicle profiles) to use |
yes |
|
exclusions |
List of restriction rules to use, separated by the , or ; character (Example: Toll, Tunnel, Bridge) |
yes |
|
timeLine |
List of intermediate durations to calculate positions along the route trajectory. Expressed in seconds, separated by the ; character |
yes |
Output
Route (routeResult)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Total route distance in metres. |
durationSeconds |
string |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
geometryWkt |
string |
0/1 |
Geometry of the route in WKT format |
simplifiedWkt |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRoute (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timellineItem (or array in JSON / JSON-P) |
0/unlimited |
List of calculated positions. |
Route segment (subRoute)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
string |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segment (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segment)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
string |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
Route position (timeLineItem)
parameter | type | min/max | description |
---|---|---|---|
elapsedTimeSeconds |
double |
0/1 |
Route duration in seconds up to this position. |
message |
string |
0/1 |
Error message for this position. |
status |
string |
0/1 |
Status of this position. |
distanceMeters |
double |
0/1 |
Distance of the route in metres up to this position. |
coordinates |
string |
0/1 |
Coordinates of the position. |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:routeV2> <!--Optional:--> <request> <origin> <x>-1.351448</x> <y>47.446923</y> </origin> <destination> <x>-1.34529</x> <y>47.4479931</y> </destination> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>-1.34981</x> <y>47.44837</y> </waypoint> </waypoints> <!--Optional:--> <srs>epsg:4326</srs> <!--Optional:--> <method>time</method> <!--Optional:--> <format>STANDARD</format> <!--Optional:--> <tolerance>0.</tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime>2015-07-29T09:00:00.000+01:00</startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Zero or more repetitions:--> <rejectFlags></rejectFlags> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> <!--Optional:--> <timeLine> <!--Zero or more repetitions:--> <timeLineItem>5</timeLineItem> <timeLineItem>15</timeLineItem> </timeLine> </request> </sch:routeV2> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeV2Response xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>640 m</distance> <duration>0:01:24</duration> <distanceMeters>640</distanceMeters> <durationSeconds>84.87</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <geometryWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</geometryWkt> <simplifiedWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</simplifiedWkt> <leg> <distance>233 m</distance> <duration>0:00:36</duration> <distanceMeters>233.1</distanceMeters> <durationSeconds>36.16</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:24</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>24.83</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:00:48</duration> <distanceMeters>406.9</distanceMeters> <durationSeconds>48.71</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:02</duration> <distanceMeters>17.62</distanceMeters> <durationSeconds>2.11</durationSeconds> <name/> </step> <step> [...] </step> </leg> <startDateTime>2015-07-29T13:30:00.000+05:30</startDateTime> <finishDateTime>2015-07-29T13:31:24.870+05:30</finishDateTime> <timeLineItem> <elapsedTimeSeconds>5.0</elapsedTimeSeconds> <status>OK</status> <distanceMeters>27.90894700354487</distanceMeters> <coordinates>-1.351356,47.447160</coordinates> </timeLineItem> <timeLineItem> <elapsedTimeSeconds>15.0</elapsedTimeSeconds> <status>OK</status> <distanceMeters>83.72684101063462</distanceMeters> <coordinates>-1.351156,47.447643</coordinates> </timeLineItem> </RouteResult> </ns2:routeV2Response> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route/v2.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
JSON-P query
http://<server>/<webapp>/api/lbs/route/v2.json?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route/v2.xml?origin=-1.351448,47.446923&destination=-1.34529,47.4479931&waypoints=-1.34981,47.44837
Response
The response is always in UTF-8 format.
JSON format
{ "message":null, "status":"OK", "distance":"640 m", "duration":"0:02:06", "distanceMeters":"639.97", "durationSeconds":"126.55", "bounds":"-1.351448,47.446922;-1.345263,47.44848", "geometryWkt":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "simplifiedWkt":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs":[ { "distance":"233 m", "duration":"0:00:46", "distanceMeters":"233.09", "durationSeconds":"46.21", "steps":[ { "distance":"139 m", "duration":"0:00:29", "distanceMeters":"138.59", "durationSeconds":"29.21", "navInstruction":null, "name":"RUE LA FONTAINE BRUNEAU", "points":[ ] }, { [...] } ] }, { "distance":"407 m", "duration":"0:01:20", "distanceMeters":"406.88", "durationSeconds":"80.34", "steps":[ { "distance":"18 m", "duration":"0:00:03", "distanceMeters":"17.63", "durationSeconds":"3.17", "navInstruction":null, "name":"", "points":[ ] }, { [...] } ] } ], "startDateTime":null, "finishDateTime":null }
JSON-P format
myCallback( { "message":null, "status":"OK", "distance":"640 m", "duration":"0:02:06", "distanceMeters":"639.97", "durationSeconds":"126.55", "bounds":"-1.351448,47.446922;-1.345263,47.44848", "geometryWkt":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "simplifiedWkt":"LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])", "legs":[ { "distance":"233 m", "duration":"0:00:46", "distanceMeters":"233.09", "durationSeconds":"46.21", "steps":[ { "distance":"139 m", "duration":"0:00:29", "distanceMeters":"138.59", "durationSeconds":"29.21", "navInstruction":null, "name":"RUE LA FONTAINE BRUNEAU", "points":[ ] }, { [...] } ] }, { "distance":"407 m", "duration":"0:01:20", "distanceMeters":"406.88", "durationSeconds":"80.34", "steps":[ { "distance":"18 m", "duration":"0:00:03", "distanceMeters":"17.63", "durationSeconds":"3.17", "navInstruction":null, "name":"", "points":[ ] }, { [...] } ] } ], "startDateTime":null, "finishDateTime":null } );
XML format
<?xml version="1.0" encoding="UTF-8"?> <routeResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.97</distanceMeters> <durationSeconds>126.55</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <geometryWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</geometryWkt> <simplifiedWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</simplifiedWkt> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.21</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.21</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.88</distanceMeters> <durationSeconds>80.34</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.17</durationSeconds> <name /> </step> <step> [...] </step> </leg> </routeResult>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route/v2.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResult/status is OK)
<?xml version="1.0" encoding="UTF-8"?> <routeResult> <status>OK</status> <distance>640 m</distance> <duration>0:02:06</duration> <distanceMeters>639.97</distanceMeters> <durationSeconds>126.55</durationSeconds> <bounds>-1.351448,47.446922;-1.345263,47.44848</bounds> <geometryWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</geometryWkt> <simplifiedWkt>LINESTRING (-1.351448 47.446923, -1.351439 47.446922, -1.35142 47.44699, [...])</simplifiedWkt> <leg> <distance>233 m</distance> <duration>0:00:46</duration> <distanceMeters>233.09</distanceMeters> <durationSeconds>46.21</durationSeconds> <step> <distance>139 m</distance> <duration>0:00:29</duration> <distanceMeters>138.59</distanceMeters> <durationSeconds>29.21</durationSeconds> <name>RUE LA FONTAINE BRUNEAU</name> </step> <step> [...] </step> </leg> <leg> <distance>407 m</distance> <duration>0:01:20</duration> <distanceMeters>406.88</distanceMeters> <durationSeconds>80.34</durationSeconds> <step> <distance>18 m</distance> <duration>0:00:03</duration> <distanceMeters>17.63</distanceMeters> <durationSeconds>3.17</durationSeconds> <name /> </step> <step> [...] </step> </leg> </routeResult>
Case of a forgotten specification of a start or finish point (routeResult/status is ERROR)
<routeResult> <message>Origin and destination must be not null</message> <status>ERROR</status> </routeResult>
Case of a faulty format assigned to the start or finish point or to route stops (routeResult/status is ERROR)
<routeResult> <message>Origin, destination and waypoints should be represented by a couple of coordinates</message> <status>ERROR</status> </routeResult>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 146.691012, 47.384813, 0.000000 } failed to connect waypoint { 146.691012, 47.384813, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
Input
parameter | description | optional | default |
---|---|---|---|
origin |
Start point coordinates. |
no |
|
destination |
Finish point coordinates. |
no |
|
waypoints |
Coordinates for route stops. |
yes |
|
method |
the shortest (distance) and fastest (time) route |
yes |
time |
format |
- standard: result = route summary / waypoints / geometry in wkt format / simplified geometry in wkt format / list of concatenated
segments (without geometries) |
yes |
standard |
projection |
Deprecated, replaced by srs |
yes |
|
srs |
projection (EPSG code such as epsg:4326 or wgs84) |
yes |
|
tolerance |
Tolerance distance (in metres) for the geometry simplification. |
yes |
|
graphName |
Name of the graph to use |
yes |
|
map |
Deprecated: Name of the map to use |
yes |
|
applyMapPrecisionOut |
Deprecated: Precision of the map |
yes |
|
startDateTime |
Start date and time (format ISO8601: local time) example: 2014-01-21T09:00:00.000+01:00 (or 2014-01-21T09:00:00.000%2B01:00) for a start on 21 January 2014, at 9.00am in Paris |
yes |
|
profileId |
Vehicle identifier (saved under vehicle profiles) to use |
yes |
|
profileName |
Vehicle profile (saved under vehicle profiles) to use |
yes |
|
rejectFlags |
Deprecated, replaced by exclusions |
yes |
|
exclusions |
List of restriction rules to use, separated by the , or ; character (Example: Toll, Tunnel, Bridge) |
yes |
Output
Route (routeResult)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Total route distance in metres. |
durationSeconds |
string |
0/1 |
Total duration of the route in seconds. |
waypoints |
string |
0/1 |
Waypoints (BoundingBox) for the route geometry. |
geometryWkt |
string |
0/1 |
Geometry of the route in WKT format |
simplifiedWkt |
string |
0/1 |
Simplified geometry in WKT format. |
leg (or legs in JSON / JSON-P) |
subRoute (or array in JSON / JSON-P) |
0/unlimited |
List of route segments. |
startDateTime |
string |
0/1 |
Start date and time (format: ISO8601 without any area code: local time) |
finishDateTime |
string |
0/1 |
Arrival date and time (format: ISO8601 without any area code: local time) |
timeLineItem |
timellineItem (or array in JSON / JSON-P) |
0/unlimited |
Not implemented in this version. |
Route segment (subRoute)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
string |
0/1 |
Duration of the route segment in seconds. |
step or (or steps in JSON / JSON-P) |
segment (or array in JSON / JSON-P) |
0/unlimited |
List of component segments in the route segments |
Route segment (segment)
parameter | type | min/max | description |
---|---|---|---|
distance |
string |
0/1 |
Total route distance, formatted: |
duration |
string |
0/1 |
Total duration of the route, formatted: |
distanceMeters |
string |
0/1 |
Distance covered by the route segment in metres. |
durationSeconds |
string |
0/1 |
Duration of the route segment in seconds. |
navigationInstruction |
string |
0/1 |
Navigation instruction code: |
name |
string |
0/1 |
Segment street name. |
point |
string |
0/unlimited |
List of coordinates separated by the , character |
WSDL
http://<server>
/<webapp>
/api/ws/routeService?wsdl
Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas"> <soapenv:Header/> <soapenv:Body> <sch:route> <!--Optional:--> <request> <origin> <x>0.691012</x> <y>47.384813</y> </origin> <destination> <x>0.693012</x> <y>47.385813</y> </destination> <!--Optional:--> <waypoints> <!--Zero or more repetitions:--> <waypoint> <x>0.692012</x> <y>47.384813</y> </waypoint> </waypoints> <!--Optional:--> <srs></srs> <!--Optional:--> <method></method> <!--Optional:--> <format></format> <!--Optional:--> <tolerance></tolerance> <!--Optional:--> <graphName></graphName> <!--Optional:--> <startDateTime></startDateTime> <!--Optional:--> <profileId></profileId> <!--Optional:--> <profileName></profileName> <!--Zero or more repetitions:--> <rejectFlags></rejectFlags> <!--Optional:--> <exclusions> <!--Zero or more repetitions:--> <exclusion></exclusion> </exclusions> </request> </sch:route> </soapenv:Body> </soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:routeResponse xmlns:ns2="http://geoconcept.com/gc/schemas"> <RouteResult> <status>OK</status> <distance>577 m</distance> <duration>0:02:49</duration> <bounds>0.69089,47.38404;0.693012,47.386078</bounds> <geometryWkt>LINESTRING (0.6910119767724592 47.38481290982329, 0.6910138207911578 47.384806371938815, ...)</geometryWkt> <simplifiedWkt>LINESTRING (0.6910119767724592 47.38481290982329, 0.6910138207911578 47.384806371938815, ...)</simplifiedWkt> <leg> <distance>266 m</distance> <duration>0:01:08</duration> <step> <distance>10</distance> <duration>2</duration> <name>RUE EUPATORIA</name> </step> <step> <distance>86</distance> <duration>18</duration> <navInstruction>L</navInstruction> <name>AVENUE DE GRAMMONT</name> </step> <step> <distance>13</distance> <duration>2</duration> <navInstruction>L</navInstruction> <name>PLACE VAILLANT</name> </step> <step> <distance>66</distance> <duration>12</duration> <navInstruction>L</navInstruction> <name>AVENUE DE GRAMMONT</name> </step> <step> <distance>89</distance> <duration>32</duration> <navInstruction>R</navInstruction> <name>RUE PARMENTIER</name> </step> </leg> <leg> <distance>311 m</distance> <duration>0:01:40</duration> <step> <distance>90</distance> <duration>33</duration> <name>RUE PARMENTIER</name> </step> <step> <distance>153</distance> <duration>32</duration> <navInstruction>L</navInstruction> <name>RUE MICHELET</name> </step> <step> <distance>66</distance> <duration>35</duration> <navInstruction>R</navInstruction> <name>RUE DUPORTAL</name> </step> </leg> </RouteResult> </ns2:routeResponse> </soap:Body> </soap:Envelope>
Query
JSON query
http://<server>/<webapp>/api/lbs/route.json?origin=0.691012,47.384813&destination=0.693012,47.385813&waypoints=0.692012,47.384813
JSON-P query
http://<server>/<webapp>/api/lbs/route.json?origin=0.691012,47.384813&destination=0.693012,47.385813&waypoints=0.692012,47.384813&callback=myCallback
XML query
http://<server>/<webapp>/api/lbs/route.xml?origin=0.691012,47.384813&destination=0.693012,47.385813&waypoints=0.692012,47.384813
Response
The response is always in UTF-8 format.
JSON format
{ "message":null,"status":"OK", "distance":"577 m","duration":"0:02:49","bounds":"475757.89,2266229.66;475920.47,2266453.7", "geometryWkt":"LINESTRING (475767.17 2266316.12, 475767.3 2266315.39, ...)", "legs": [ {"distance":"266 m","duration":"0:01:08", "steps": [ {"distance":"10","duration":"2","navInstruction":null,"name":"RUE EUPATORIA","points":[]}, {"distance":"86","duration":"18","navInstruction":"L","name":"AVENUE DE GRAMMONT","points":[]}, {"distance":"13","duration":"2","navInstruction":"L","name":"PLACE VAILLANT","points":[]}, {"distance":"66","duration":"12","navInstruction":"L","name":"AVENUE DE GRAMMONT","points":[]}, {"distance":"89","duration":"32","navInstruction":"R","name":"RUE PARMENTIER","points":[]} ] }, {"distance":"311 m","duration":"0:01:40", "steps": [ {"distance":"90","duration":"33","navInstruction":null,"name":"RUE PARMENTIER","points":[]}, {"distance":"153","duration":"32","navInstruction":"L","name":"RUE MICHELET","points":[]}, {"distance":"66","duration":"35","navInstruction":"R","name":"RUE DUPORTAL","points":[]} ] } ], "startDateTime":null,"finishDateTime":null }
JSON-P format
myCallback( { "message":null,"status":"OK", "distance":"577 m","duration":"0:02:49","bounds":"475757.89,2266229.66;475920.47,2266453.7", "geometryWkt":"LINESTRING (475767.17 2266316.12, 475767.3 2266315.39, ...)", "legs": [ {"distance":"266 m","duration":"0:01:08", "steps": [ {"distance":"10","duration":"2","navInstruction":null,"name":"RUE EUPATORIA","points":[]}, {"distance":"86","duration":"18","navInstruction":"L","name":"AVENUE DE GRAMMONT","points":[]}, {"distance":"13","duration":"2","navInstruction":"L","name":"PLACE VAILLANT","points":[]}, {"distance":"66","duration":"12","navInstruction":"L","name":"AVENUE DE GRAMMONT","points":[]}, {"distance":"89","duration":"32","navInstruction":"R","name":"RUE PARMENTIER","points":[]} ] }, {"distance":"311 m","duration":"0:01:40", "steps": [ {"distance":"90","duration":"33","navInstruction":null,"name":"RUE PARMENTIER","points":[]}, {"distance":"153","duration":"32","navInstruction":"L","name":"RUE MICHELET","points":[]}, {"distance":"66","duration":"35","navInstruction":"R","name":"RUE DUPORTAL","points":[]} ] } ], "startDateTime":null,"finishDateTime":null } );
XML format
<routeResult> <status>OK</status> <distance>577 m</distance> <duration>0:02:49</duration> <bounds>475757.89,2266229.66;475920.47,2266453.7</bounds> <geometryWkt>LINESTRING (475767.17 2266316.12, 475767.3 2266315.39, ...)</geometryWkt> <simplifiedWkt>LINESTRING (475767.17 2266316.12, 475767.3 2266315.39, ...)</simplifiedWkt> <leg> <distance>266 m</distance> <duration>0:01:08</duration> <step> <distance>10</distance> <duration>2</duration> <name>RUE EUPATORIA</name> </step> <step> <distance>86</distance> <duration>18</duration> <navInstruction>L</navInstruction> <name>AVENUE DE GRAMMONT</name> </step> <step> <distance>13</distance> <duration>2</duration> <navInstruction>L</navInstruction> <name>PLACE VAILLANT</name> </step> <step> <distance>66</distance> <duration>12</duration> <navInstruction>L</navInstruction> <name>AVENUE DE GRAMMONT</name> </step> <step> <distance>89</distance> <duration>32</duration> <navInstruction>R</navInstruction> <name>RUE PARMENTIER</name> </step> </leg> <leg> <distance>311 m</distance> <duration>0:01:40</duration> <step> <distance>90</distance> <duration>33</duration> <name>RUE PARMENTIER</name> </step> <step> <distance>153</distance> <duration>32</duration> <navInstruction>L</navInstruction> <name>RUE MICHELET</name> </step> <step> <distance>66</distance> <duration>35</duration> <navInstruction>R</navInstruction> <name>RUE DUPORTAL</name> </step> </leg> </routeResult>
JavaScript API
Include the JavaScript library
var routeCtrl = new GCUI.Control.Route(); routeCtrl.route({ url:'http://<server>/<webapp>/api/lbs/route.json', tolerance : 100, origin : new OpenLayers.LonLat(0.691012, 47.384813), destination : new OpenLayers.LonLat(0.691012, 47.384813), waypoints : [ new OpenLayers.LonLat(2.344408, 49.898798) ], callback : function(result, options) { console.log(result); } });
The result
variable is in JSON format as described above. The callback
function passed to parameter is called at the end of the route calculation.
Case of a route found (routeResult/status is OK)
<routeResult> <status>OK</status> <distance>1.66 Km</distance> <duration>0:04:53</duration> <bounds>2.423385,48.84452;2.43999,48.84741</bounds> <geometryWkt>LINESTRING (2.4233899276812516 48.84461991900793, 2.4233847309012826 48.84462042192212, ...)</geometryWkt> <simplifiedWkt>LINESTRING (2.4233899276812516 48.84461991900793, 2.4233847309012826 48.84462042192212, ...)</simplifiedWkt> <leg> <distance>1.66 Km</distance> <duration>0:04:53</duration> <step> <distance>147</distance> <duration>31</duration> <name>AVENUE PASTEUR</name> </step> <step> <distance>1108</distance> <duration>159</duration> <navInstruction>R</navInstruction> <name>AVENUE DE PARIS</name> </step> ... </step> </leg> </routeResult>
Case of a forgotten specification of a start or finish point (routeResult/status is ERROR)
<routeResult> <message>Origin and destination must be not null</message> <status>ERROR</status> </routeResult>
Case of a faulty type (serviceResult/status is ERROR)
<serviceResult> <message>NumberFormatException: For input string: "AAA"</message> <status>ERROR</status> </serviceResult>
Case of a snap-to-graph error (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting Failed to execute calculateRoute com.geoconcept.smartrouting.SmartRoutingNativeException: failed to connect waypoint { 243966.000000, 48.847410, 0.000000 } failed to connect waypoint { 243966.000000, 48.847410, 0.000000 }</message> <status>ERROR</status> </serviceResult>
Case of a problem with the graph: absent file, faulty filepath, etc… (serviceResult/status is ERROR)
<serviceResult> <message>ServiceException: Error in route computation Error in smartrouting datasource is null</message> <status>ERROR</status> </serviceResult>
- 1. Is it possible to give priority to either journey time or distance?
- 2. Can I use aliases instead of .siti file names to call a datasource?
- 3. How can I use route statistics?
- 4. Is the order of points important?
- 5. How can I perform a route calculation excluding toll roads?
- 6. What are Speed Patterns? How can I use them?
- 7. How to use Heavy Goods Vehicle attributes?
- 8. How is carbon footprint for a route calculated?