Compact matrix calculation

(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.

Basic principles

This web service calculates a route matix for a series of points and returns a distance matrix. It draws on the configured graph the name of which has been specified in the Geoconcept Web administration interface.

This web service is a variation of the matrix calculation web service that returns exactly the same results, but in another format.

Availability

This web service is available at all times with Geoconcept Web in tandem with a graph.

Version change

Earlier versions of the web service are conserved in Geoconcept Web to ensure compatibility with previous software developments. We recommend using the most recent version.

Changes in relation to V3

  • Addition of "timeOut" and "computeOptions" parameters.
  • Addition to the "nodes" snapMethod of snap to nearest nodes.

Changes in relation to V2

  • Addition of the notion of the node, faster, to snap to graph nodes rather than to geographic coordinates. Addition of the following items: "originNodes", "destinationNodes" and "nodes" in the snapMethod.
  • Addition of the "maxCost" parameter.

V3

Parameters / properties

Input

parameter description optional default

srs

projection (EPSG code such as epsg:4326 or wgs84)

yes

origins

List of the coordinates for points of origin. Longitude and Latitude coordinates are separated by , characters.

yes

originNodes

List of origin ids nodes. Ids nodes are separated by the . character. Note: a physical node does not have the same ID in another graph.

yes

destinations

List of coordinates for destination points. Longitude and Latitude coordinates are separaged by . characters.

yes

destinationNodes

List of destination ids nodes. ids nodes are separated by . characters. Note: a physical node does not have the same ID in another graph.

yes

graphName (depreciated)

Name of the graph to use
This parameter is omitted if the configName parameter is used.

yes

method

shortest route (distance) or fastest route (time)

yes

time

profileId (depreciated)

Vehicle identifier (saved under vehicle profiles)
This parameter is omitted if the configName parameter is used.

yes

profileName (depreciated)

Vehicle profile (saved under vehicle profiles)
This parameter is omitted if the configName parameter is used.

yes

exclusions

List of restriction regulations to use, separated by ; character (Example: Toll, Tunnel, Bridge)

yes

startDateTime

Departure 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 departure on 21 Januray 2014, at 9.00am in Paris. Caution: the + character may be misinterpreted by browsers, so in this case it should be replaced by %2B.

yes

snapMethod

Snap to graph method
- standard: to the nearest connectable road section
- extended: via restricted road sections (pedestrian routes…)
- nearest: to the nearest road section only
- unrestricted: without any restriction rules
- nodes: Snap directly to nodes supplied by the originNode, destinationNode and waypointNodes parameters, or, if these parameters have not been set, to the nearest nodes sourced by the origin, destination and waypoint parameters

yes

standard

avoidArea

Forbidden transit zone in WKT format (POLYGON or MULTIPOLYGON) in the requested projection (srs parameter)
Example in wgs84: POLYGON ((-1.556892 47.21689, -1.556892 47.216904, [...] -1.556892 47.21689)) - MULTIPOLYGON (((-1.556892 47.21689, -1.556892 47.216904, [...] -1.556892 47.21689)), ((-1.558639 47.218144, -1.558639 47.218193, [...] -1.558639 47.218144)))
NOTE: WKT geometries must be closed.

yes

configName

Name of the configuration to use (defined in Geoconcept Web - Administration / Tools / Road graphs)
This replaces the use of graphName, profileId and profileName

yes

computeOptions

List of options for the calculation,separated by ; characters
- trafficPatterns: uses routing statistics (you will need to supply a value for the startDateTime parameter and use a graph that includes traffic patterns information)
- speedPattern (M18): uses a speed pattern as defined in the SmartRoutingVehicles.xml file, located in the `‘<GEOCONCEPT_WEB_HOME>’'\smartrouting\jee\smartrouting\conf\ folder. Use as follows: "speedPattern:slow-speed"
- length (M18): maximum authorised length in centimeters (you need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "length:950"
- width (M18): maximum authorised width in centimeters (You will need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "width:255"
- height (M18): maximum authorised height in centimeters (you will need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "height:360"
- weight (M18): maximum authorised weight in kilograms (you will need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "weight:18000"
- axles (M18): maximum authorised number of axles (you will need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "axles:2"
- weightPerAxle (M18): maximum authorised weight per axle in kilograms (you will need to use a graph that includes Heavy Goods Vehicle attributes). Use as follows: "weightPerAxle:9000"
- snapSpeed: snap-to-graph speed in kilometers per hour. Use as follows: "snapSpeed:10"

yes

maxCost

Maximum cost not to exceed in the results

-1: no maximum cost to take into account
0: take the default value defined in the SmartRouting Server configuration
ifnot: value in metres if method=distance or in seconds if method=time

yes

timeOut

Time out for the calculation (in milliseconds)

yes

(*) At least one of the two parameter pairs origins/destinations or originNodes/destinationsNodes must be defined.

(M18) Available from version M18 and later versions of graphs supplied by GEOCONCEPT SAS.

Output

Matrix (compactMatrixResultV3)

parameter type min/max description

distanceMeters/distanceMeter

array (compactRowV3)

0/unlimited

Distance matrix result (in metres)

durationSeconds/durationSecond

array (compactRowV3)

0/unlimited

Time matrix result (in seconds)

SOAP

WSDL

http://<server>/<webapp>/api/ws/compactMatrixService?wsdl

Query

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:compactMatrixV3>
         <!--Optional:-->
         <request>
            <!--Optional:-->
            <srs>epsg:27572</srs>
            <!--Optional:-->
            <origins>
               <!--1 or more repetitions:-->
               <origin>
                  <x>315846.96</x>
                  <y>2254268.35</y>
               </origin>
                <origin>
                  <x>313584.77</x>
                  <y>2251648.97</y>
               </origin>
            </origins>
            <!--Optional:-->
            <originNodes>
               <!--1 or more repetitions:-->
               <originNode></originNode>
            </originNodes>
            <!--Optional:-->
            <destinations>
               <!--1 or more repetitions:-->
               <destination>
                  <x>321442.89</x>
                  <y>2251013.98</y>
               </destination>
                <destination>
                  <x>318982.27</x>
                  <y>2248315.22</y>
               </destination>
            </destinations>
            <!--Optional:-->
            <destinationNodes>
               <!--1 or more repetitions:-->
               <destinationNode></destinationNode>
            </destinationNodes>
            <!--Optional:-->
            <graphName></graphName>
            <!--Optional:-->
            <method>time</method>
            <!--Optional:-->
            <profileId></profileId>
            <!--Optional:-->
            <profileName></profileName>
            <!--Optional:-->
            <exclusions>
               <!--Zero or more repetitions:-->
               <exclusion></exclusion>
            </exclusions>
            <!--Optional:-->
            <startDateTime></startDateTime>
            <!--Optional:-->
            <snapMethod></snapMethod>
            <!--Optional:-->
            <avoidArea></avoidArea>
            <!--Optional:-->
            <configName></configName>
            <!--Optional:-->
            <computeOptions></computeOptions>
            <!--Optional:-->
            <timeOut></timeOut>
            <!--Optional:-->
            <maxCost></maxCost>
         </request>
      </sch:compactMatrixV3>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:compactMatrixV3Response xmlns:ns2="http://geoconcept.com/gc/schemas">
         <CompactMatrixResult>
            <status>OK</status>
            <distanceMeters>
               <distanceMeter>8109,11249</distanceMeter>
               <distanceMeter>11737,7637</distanceMeter>
            </distanceMeters>
            <durationSeconds>
               <durationSecond>565,816</durationSecond>
               <durationSecond>857,526</durationSecond>
            </durationSeconds>
         </CompactMatrixResult>
      </ns2:compactMatrixV3Response>
   </soap:Body>
</soap:Envelope>
REST

Query

JSON query 

http://<server>/<webapp>/api/lbs/compactMatrix/v3.json?origins=315846.96,2254268.35;313584.77,2251648.97&destinations=321442.89,2251013.98;318982.27,2248315.22&srs=epsg:27572&method=time

JSON-P query 

http://<server>/<webapp>/api/lbs/compactMatrix/v3.json?origins=315846.96,2254268.35;313584.77,2251648.97&destinations=321442.89,2251013.98;318982.27,2248315.22&srs=epsg:27572&method=time&callback=myCallback

Response

The response is always in UTF-8 format.

JSON format 

{
        "message": null,
        "status": "OK",
        "distanceMeters": [
                [
                        8109,
                        11249
                ],
                [
                        11737,
                        7637
                ]
        ],
        "durationSeconds": [
                [
                        657,
                        889
                ],
                [
                        960,
                        609
                ]
        ]
}

JSON-P format 

myCallback(
    {
        "message": null,
        "status": "OK",
        "distanceMeters": [
            [
                8109,
                11249
            ],
            [
                11737,
                7637
            ]
        ],
        "durationSeconds": [
            [
                657,
                889
            ],
            [
                960,
                609
            ]
        ]
    }
);

Possible responses

Case of a found itinerary (compactMatrixResultV2/status is OK) 

<compactMatrixResultV3>
   <status>OK</status>
   <distanceMeters>
      <distanceMeter>8109,11249</distanceMeter>
      <distanceMeter>11737,7637</distanceMeter>
   </distanceMeters>
   <durationSeconds>
      <durationSecond>657,889</durationSecond>
      <durationSecond>960,609</durationSecond>
   </durationSeconds>
</compactMatrixResultV3>

Case of a forgotten origin or destination specification tool (compactMatrixResultV2/status is ERROR) 

<compactMatrixResultV3>
   <message>Origins and destinations must be not null</message>
   <status>ERROR</status>
</compactMatrixResultV3>

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 (compactMatrixResultV2/status is OK) / (cell/status is KO) 

<compactMatrixResultV3>
   <status>OK</status>
   <origins>
      <origin>-0.36147,49.18392</origin>
      <origin>7.26132,43.70629</origin>
   </origins>
   <destinations>
      <destination>146.08821,48.43253</destination>
      <destination>2.34878,48.86473</destination>
   </destinations>
   <rows>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>234196.77000000002</distanceMeters>
               <durationSeconds>9451.57</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>930934.64</distanceMeters>
               <durationSeconds>31773.440000000002</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
   </rows>
</compactMatrixResultV3>

Case of a problem with the graph: absent file, bad filepath, etc… (serviceResult/status is ERROR) 

<serviceResult>
   <message>ServiceException: Error in matrix computation
Error in smartrouting
datasource is null</message>
   <status>ERROR</status>
</serviceResult>

V2

Parameters / properties

Input

parameter description optional default

srs

projection (EPSG code such as epsg:4326 or wgs84)

yes

origins

List of the coordinates for points of origin. Longitude and Latitude coordinates are separated by , characters.

yes

originNodes

List of origin ids nodes. Ids nodes are separated by the . character. Note: a physical node does not have the same ID in another graph.

yes

destinations

List of coordinates for destination points. Longitude and Latitude coordinates are separaged by . characters.

yes

destinationNodes

List of destination ids nodes. ids nodes are separated by . characters. Note: a physical node does not have the same ID in another graph.

yes

graphName

Name of the graph to use
This parameter is omitted if the configName parameter is used.

yes

method

shortest route (distance) or fastest route (time)

yes

time

profileId

Vehicle identifier (saved under vehicle profiles)
This parameter is omitted if the configName parameter is used.

yes

profileName

Vehicle profile (saved under vehicle profiles)
This parameter is omitted if the configName parameter is used.

yes

exclusions

List of restriction rules to use, separated by the , or ; character (Example: "Toll", "Tunnel", "Bridge")

yes

startDateTime

Departure 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 departure on 21 Januray 2014, at 9.00am in Paris. Caution: the + character may be misinterpreted by browsers, so in this case it should be replaced by %2B.

yes

snapMethod

Snap to graph method
- standard: to the nearest connectable road section
- extended: via restricted road sections (pedestrian routes…)
- nearest: only to the nearest road section
- unrestricted: without any restriction rules
- nodes: direct snap-to nodes indicated by locationNode and node parameters for resources

yes

standard

avoidArea

Forbidden transit zone in WKT format (POLYGON or MULTIPOLYGON) in the requested projection (srs parameter)
Example in wgs84: POLYGON ((-1.556892 47.21689, -1.556892 47.216904, [...] -1.556892 47.21689)) - MULTIPOLYGON (((-1.556892 47.21689, -1.556892 47.216904, [...] -1.556892 47.21689)), ((-1.558639 47.218144, -1.558639 47.218193, [...] -1.558639 47.218144)))
NOTE: WKT geometries must be closed.

yes

configName

Name of the configuration to use (defined in Geoconcept Web - Administration / Tools / Road graphs)
This replaces the use of graphName, profileId and profileName

yes

maxCost

Maximum cost not to exceed in the results

-1: no maximum cost to take into account
0: take the default value defined in the SmartRouting Server configuration
ifnot: value in metres if method=distance or in seconds if method=time

yes

(*) At least one of the two parameter pairs origins/destinations or originNodes/destinationsNodes must be defined.

Output

Matrix (compactMatrixResultV2)

parameter type min/max description

distanceMeters/distanceMeter

array (compactRowV2)

0/unlimited

Distance matrix result (in metres)

durationSeconds/durationSecond

array (compactRowV2)

0/unlimited

Time matrix result (in seconds)

SOAP

WSDL

http://<server>/<webapp>/api/ws/compactMatrixService?wsdl

Query

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:compactMatrixV2>
         <!--Optional:-->
         <request>
            <!--Optional:-->
            <srs>epsg:27572</srs>
            <!--Optional:-->
            <origins>
               <!--1 or more repetitions:-->
               <origin>
                  <x>315846.96</x>
                  <y>2254268.35</y>
               </origin>
                <origin>
                  <x>313584.77</x>
                  <y>2251648.97</y>
               </origin>
            </origins>
            <!--Optional:-->
            <originNodes>
               <!--1 or more repetitions:-->
               <originNode></originNode>
            </originNodes>
            <!--Optional:-->
            <destinations>
               <!--1 or more repetitions:-->
               <destination>
                  <x>321442.89</x>
                  <y>2251013.98</y>
               </destination>
                <destination>
                  <x>318982.27</x>
                  <y>2248315.22</y>
               </destination>
            </destinations>
            <!--Optional:-->
            <destinationNodes>
               <!--1 or more repetitions:-->
               <destinationNode></destinationNode>
            </destinationNodes>
            <!--Optional:-->
            <graphName></graphName>
            <!--Optional:-->
            <method>time</method>
            <!--Optional:-->
            <profileId></profileId>
            <!--Optional:-->
            <profileName></profileName>
            <!--Optional:-->
            <exclusions>
               <!--Zero or more repetitions:-->
               <exclusion></exclusion>
            </exclusions>
            <!--Optional:-->
            <startDateTime></startDateTime>
            <!--Optional:-->
            <snapMethod></snapMethod>
            <!--Optional:-->
            <avoidArea></avoidArea>
            <!--Optional:-->
            <configName></configName>
            <!--Optional:-->
            <maxCost></maxCost>
         </request>
      </sch:compactMatrixV2>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:compactMatrixV2Response xmlns:ns2="http://geoconcept.com/gc/schemas">
         <CompactMatrixResult>
            <status>OK</status>
            <distanceMeters>
               <distanceMeter>8109,11249</distanceMeter>
               <distanceMeter>11737,7637</distanceMeter>
            </distanceMeters>
            <durationSeconds>
               <durationSecond>565,816</durationSecond>
               <durationSecond>857,526</durationSecond>
            </durationSeconds>
         </CompactMatrixResult>
      </ns2:compactMatrixV2Response>
   </soap:Body>
</soap:Envelope>
REST

Query

JSON query 

http://<server>/<webapp>/api/lbs/compactMatrix/v2.json?origins=315846.96,2254268.35;313584.77,2251648.97&destinations=321442.89,2251013.98;318982.27,2248315.22&srs=epsg:27572&method=time

JSON-P query 

http://<server>/<webapp>/api/lbs/compactMatrix/v2.json?origins=315846.96,2254268.35;313584.77,2251648.97&destinations=321442.89,2251013.98;318982.27,2248315.22&srs=epsg:27572&method=time&callback=myCallback

XML query 

http://<server>/<webapp>/api/lbs/compactMatrix/v2.xml?origins=315846.96,2254268.35;313584.77,2251648.97&destinations=321442.89,2251013.98;318982.27,2248315.22&srs=epsg:27572&method=time

Response

The response is always in UTF-8 format.

JSON format 

{
        "message": null,
        "status": "OK",
        "distanceMeters": [
                [
                        8109,
                        11249
                ],
                [
                        11737,
                        7637
                ]
        ],
        "durationSeconds": [
                [
                        657,
                        889
                ],
                [
                        960,
                        609
                ]
        ]
}

JSON-P format 

myCallback(
    {
        "message": null,
        "status": "OK",
        "distanceMeters": [
            [
                8109,
                11249
            ],
            [
                11737,
                7637
            ]
        ],
        "durationSeconds": [
            [
                657,
                889
            ],
            [
                960,
                609
            ]
        ]
    }
);

XML format 

<compactMatrixResultV2>
   <status>OK</status>
   <distanceMeters>
      <distanceMeter>8109,11249</distanceMeter>
      <distanceMeter>11737,7637</distanceMeter>
   </distanceMeters>
   <durationSeconds>
      <durationSecond>657,889</durationSecond>
      <durationSecond>960,609</durationSecond>
   </durationSeconds>
</compactMatrixResultV2>

Possible responses

Case of a found itinerary (compactMatrixResultV2/status is OK) 

<compactMatrixResultV2>
   <status>OK</status>
   <distanceMeters>
      <distanceMeter>8109,11249</distanceMeter>
      <distanceMeter>11737,7637</distanceMeter>
   </distanceMeters>
   <durationSeconds>
      <durationSecond>657,889</durationSecond>
      <durationSecond>960,609</durationSecond>
   </durationSeconds>
</compactMatrixResultV2>

Case of a forgotten origin or destination specification tool (compactMatrixResultV2/status is ERROR) 

<compactMatrixResultV2>
   <message>Origins and destinations must be not null</message>
   <status>ERROR</status>
</compactMatrixResultV2>

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 (compactMatrixResultV2/status is OK) / (cell/status is KO) 

<compactMatrixResultV2>
   <status>OK</status>
   <origins>
      <origin>-0.36147,49.18392</origin>
      <origin>7.26132,43.70629</origin>
   </origins>
   <destinations>
      <destination>146.08821,48.43253</destination>
      <destination>2.34878,48.86473</destination>
   </destinations>
   <rows>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>234196.77000000002</distanceMeters>
               <durationSeconds>9451.57</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>930934.64</distanceMeters>
               <durationSeconds>31773.440000000002</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
   </rows>
</compactMatrixResultV2>

Case of a problem with the graph: absent file, bad filepath, etc… (serviceResult/status is ERROR) 

<serviceResult>
   <message>ServiceException: Error in matrix computation
Error in smartrouting
datasource is null</message>
   <status>ERROR</status>
</serviceResult>

V1

Parameters / properties

Input

parameter description optional default

srs

projection (EPSG code such as epsg:4326 or wgs84)

yes

origins

List of the coordinates for points of origin. Longitude and Latitude coordinates are separated by , characters.

yes

destinations

List of coordinates for destination points. Longitude and Latitude coordinates are separaged by . characters.

yes

graphName

Name of the graph to use

yes

method

shortest route (distance) or fastest route (time)

yes

time

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

startDateTime

Departure 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 departure on 21 Januray 2014, at 9.00am in Paris

yes

snapMethod

Snap to graph method
- standard: to nearest connectable road section
- extended: via restricted road sections (pedestrian routes…)
- nearest: to the nearest road section only
- unrestricted: without restriction rules

yes

standard

Output

Matrix (matrixResultV2)

parameter type min/max description

origins/origin (or origins in JSON / JSON-P)

string (or array of origins/origin in JSON / JSON-P)

0/unlimited

origin positions.

destinations/destination (or destinations in JSON / JSON-P)

string (or array of destinations/destination in JSON / JSON-P)

0/unlimited

destination positions.

rows/row (or rows in JSON / JSON-P)

matrixRowV2 (or array of rows/row (matrixRow) in JSON / JSON-P)

0/unlimited

Matrix line

Matrix line (matrixRowV2)

parameter type min/max description

cells/cell (or cells in JSON / JSON-P)

matrixCellV2 (or array of cells/cell (matrixCellV2) in JSON / JSON-P)

0/unlimited

Matrix cell

Matrix cell (matrixCellV2)

parameter type min/max description

distanceMeters

double

1/1

Matrix cell distance (in metres)

durationSeconds

double

1/1

Matrix cell duration (in seconds)

status

string

0/1

Matrix cell status:
- OK : the itinerary has been found for this cell
- KO : no itinerary found for this cell

SOAP

WSDL

http://<server>/<webapp>/api/ws/compactMatrixService?wsdl

Query

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:compactMatrixV1>
         <!--Optional:-->
         <request>
            <!--Optional:-->
            <srs>epsg:27572</srs>
            <!--Optional:-->
            <origins>
               <!--1 or more repetitions:-->
               <origin>
                  <x>315846.96</x>
                  <y>2254268.3500000001</y>
               </origin>
                <origin>
                           <x>313584.77</x>
                  <y>2251648.9700000002</y>
               </origin>
            </origins>
            <!--Optional:-->
            <destinations>
               <!--1 or more repetitions:-->
               <destination>
                  <x>321442.89</x>
                  <y>2251013.98</y>
               </destination>
                <destination>
                  <x>318982.27</x>
                  <y>2248315.2200000002</y>
               </destination>
            </destinations>
            <!--Optional:-->
            <graphName></graphName>
            <!--Optional:-->
            <method>time</method>
            <!--Optional:-->
            <profileId></profileId>
            <!--Optional:-->
            <profileName></profileName>
            <!--Optional:-->
            <exclusions>
               <!--Zero or more repetitions:-->
               <exclusion></exclusion>
            </exclusions>
            <!--Optional:-->
            <startDateTime></startDateTime>
            <!--Optional:-->
            <snapMethod></snapMethod>
         </request>
      </sch:compactMatrixV1>
   </soapenv:Body>
</soapenv:Envelope>

Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:compactMatrixV1Response xmlns:ns2="http://geoconcept.com/gc/schemas">
         <MatrixResult>
            <status>OK</status>
            <origins>
               <origin>315846.96,2254268.35</origin>
               <origin>313584.77,2251648.97</origin>
            </origins>
            <destinations>
               <destination>321442.89,2251013.98</destination>
               <destination>318982.27,2248315.22</destination>
            </destinations>
            <srs>epsg:27572</srs>
            <rows>
               <row>
                  <cells>
                     <cell>
                        <distanceMeters>8109.04</distanceMeters>
                        <durationSeconds>894.48</durationSeconds>
                        <status>OK</status>
                     </cell>
                     <cell>
                        <distanceMeters>11127.53</distanceMeters>
                        <durationSeconds>873.21</durationSeconds>
                        <status>OK</status>
                     </cell>
                  </cells>
               </row>
               <row>
                  <cells>
                     <cell>
                        <distanceMeters>11736.87</distanceMeters>
                        <durationSeconds>1158.04</durationSeconds>
                        <status>OK</status>
                     </cell>
                     <cell>
                        <distanceMeters>7514.82</distanceMeters>
                        <durationSeconds>615.79</durationSeconds>
                        <status>OK</status>
                     </cell>
                  </cells>
               </row>
            </rows>
         </MatrixResult>
      </ns2:compactMatrixV1Response>
   </soap:Body>
</soap:Envelope>
REST

Query

JSON query 

http://<server>/<webapp>/api/lbs/compactMatrix/v1.json?origins=315846.96,2254268.3500000001;313584.77,2251648.9700000002&destinations=321442.89,2251013.98;318982.27,2248315.2200000002&srs=epsg:27572&method=time

JSON-P query 

http://<server>/<webapp>/api/lbs/compactMatrix/v1.json?origins=315846.96,2254268.3500000001;313584.77,2251648.9700000002&destinations=321442.89,2251013.98;318982.27,2248315.2200000002&srs=epsg:27572&method=time&callback=myCallback

XML query 

http://<server>/<webapp>/api/lbs/compactMatrix/v1.xml?origins=315846.96,2254268.3500000001;313584.77,2251648.9700000002&destinations=321442.89,2251013.98;318982.27,2248315.2200000002&srs=epsg:27572&method=time

Response

The response is always in UTF-8 format.

JSON format 

{
   "message": null,
   "status": "OK",
   "distanceMeters":    [
            [
         8109,
         11249
      ],
            [
         11737,
         7637
      ]
   ],
   "durationSeconds":    [
            [
         657,
         889
      ],
            [
         960,
         609
      ]
   ]
}

JSON-P format 

myCallback(
    {
       "message": null,
       "status": "OK",
       "distanceMeters":    [
                [
             8109,
             11249
          ],
                [
             11737,
             7637
          ]
       ],
       "durationSeconds":    [
                [
             657,
             889
          ],
                [
             960,
             609
          ]
       ]
    }
);

XML format 

<compactMatrixResult>
   <status>OK</status>
   <distanceMeters>
      <distanceMeter>8109,11249</distanceMeter>
      <distanceMeter>11737,7637</distanceMeter>
   </distanceMeters>
   <durationSeconds>
      <durationSecond>657,889</durationSecond>
      <durationSecond>960,609</durationSecond>
   </durationSeconds>
</compactMatrixResult>

Possible responses

Case of an itinerary found (matrixResultV2/status is OK) 

<compactMatrixResult>
   <status>OK</status>
   <distanceMeters>
      <distanceMeter>8109,11249</distanceMeter>
      <distanceMeter>11737,7637</distanceMeter>
   </distanceMeters>
   <durationSeconds>
      <durationSecond>657,889</durationSecond>
      <durationSecond>960,609</durationSecond>
   </durationSeconds>
</compactMatrixResult>

Case of forgotten origin or destination specification (compactMatrixResultV1/status is ERROR) 

<comcompactMatrixResultV1>
   <message>Origins and destinations must be not null</message>
   <status>ERROR</status>
</compactMatrixResultV1>

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 (compactMatrixResultV1/status is OK) / (cell/status is KO) 

<compactMatrixResultV1>
   <status>OK</status>
   <origins>
      <origin>-0.36147,49.18392</origin>
      <origin>7.26132,43.70629</origin>
   </origins>
   <destinations>
      <destination>146.08821,48.43253</destination>
      <destination>2.34878,48.86473</destination>
   </destinations>
   <rows>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>234196.77000000002</distanceMeters>
               <durationSeconds>9451.57</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
      <row>
         <cells>
            <cell>
               <distanceMeters>0.0</distanceMeters>
               <durationSeconds>0.0</durationSeconds>
               <status>KO</status>
            </cell>
            <cell>
               <distanceMeters>930934.64</distanceMeters>
               <durationSeconds>31773.440000000002</durationSeconds>
               <status>OK</status>
            </cell>
         </cells>
      </row>
   </rows>
</compactMatrixResultV1>

Case of a problem with the graph: absent file, bad filepath, etc… (serviceResult/status is ERROR) 

<serviceResult>
   <message>ServiceException: Error in matrix computation
Error in smartrouting
datasource is null</message>
   <status>ERROR</status>
</serviceResult>

FAQ

1. Can I use aliases instead of .siti file names to call a datasource?
2. How can I use route statistics?
3. How can I perform a route matrix calculation excluding toll roads?
4. What are Speed Patterns? How can I use them?

1.

Can I use aliases instead of .siti file names to call a datasource?

Yes, cf. details under FAQ for the reverse geocoding Web Service.

2.

How can I use route statistics?

Check that the graph does contain these statistics and use these two parameters: computeOptions with a value of trafficPatterns and startDateTime to specify the departure date/time.

3.

How can I perform a route matrix calculation excluding toll roads?

If the Toll constraint has been included in the graph, place an exclusion in exclusions:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://geoconcept.com/gc/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:matrix>
         <!--Optional:-->
         <request>
            <!--Optional:-->
            <srs></srs>
            <!--Optional:-->
            <origins>
               <!--1 or more repetitions:-->
               <origin>
                  <x>-0.361470</x>
                  <y>49.183920</y>
               </origin>
               <origin>
                  <x>7.261320</x>
                  <y>43.706290</y>
               </origin>
            </origins>
            <!--Optional:-->
            <destinations>
               <!--1 or more repetitions:-->
               <destination>
                  <x>0.088210</x>
                  <y>48.432530</y>
               </destination>
               <destination>
                  <x>2.348780</x>
                  <y>48.864730</y>
               </destination>
            </destinations>
            <!--Optional:-->
            <graphName></graphName>
            <!--Optional:-->
            <method></method>
            <!--Optional:-->
            <profileId></profileId>
            <!--Optional:-->
            <profileName></profileName>
            <!--Optional:-->
            <exclusions>Toll</exclusions>
         </request>
      </sch:matrix>
   </soapenv:Body>
</soapenv:Envelope>

4.

What are Speed Patterns? How can I use them?

In order to propose journey times that are as accurate as possible and reflect changing traffic conditions, graphs supplied by GEOCONCEPT SAS include, from version M18 upwards, 5 speed profiles (Speed Patterns) for cars and lorries, to take into account the different levels of congestion during the course of one day:

  • standard normal-speed corresponds to the speed at a time when the roads have an average congestion level (eg 11.00am)
  • night fast-speed corresponds to a very fluid traffic situation, often experienced at night-time (3.00am)
  • congested slow-speed corresponds to the times when traffic is densest (8.00am)
  • rush hour very-slow-speed corresponds to times when traffic is densest in urban and built-up areas, and is slower than the speed above (8.00am)
  • default default corresponds to speeds averaged out over an entire day

To use them, you need to pass to parameter, when calling the web service, the computeOptions parameter with the speedPattern option and specify the value of the Speed Pattern requested, without forgetting a vehicle profile
Example:

+

&computeOptions=speedPattern:fast-speed&profileId=1
How to use Heavy Goods Vehicle attributes?

The graph must include the attributes for Heavy Goods Vehicles (as standard in the graphs supplied by GEOCONCEPT SAS from version M18 upwards) and either calculate an itinerary using a vehicle profile using restrictions (cf. the catalogue of vehicles, editable, defined in the SmartRoutingVehicles.xml file, stored in the folder `‘<GEOCONCEPT_WEB_HOME>’'\smartrouting\jee\smartrouting\conf\ ), or overwrite the call to the web service by using the computeOptions parameter with the options length, width, height, weight, axles and/or weightPerAxle.
Example for a journey with a vehicle 4.5 metres high:

&computeOptions=height:450