Class: Routing

cercalia.service.Routing


new cercalia.service.Routing(opt_options)

src/cercalia/service/routing.js, line 17

Constructor del servei Service Routing

Name Type Description
options

Options

Name Type Description
edges boolean | undefined

Get edges IDs

infoedges boolean | undefined

Adds specific information for each section to the route report.
An infoedges tag is added to each substage with specific information of each section.
The following attributes are reported for each section:
height: height from sea level in meters.
gradient: slope of the section
geometry: Stretch geometry
meters: Length of the section
maxkph: Legal maximum speed

destination cercalia.LonLat | cercaliax.service.RoutingStep | undefined

Destination coordinates.

lang string | undefined

Report language (only if report parameter is true).

mindist number | undefined

Minimum substage distance, in meters. The larger this distance , the smaller the number of substages. Default value 1000.

origin cercalia.LonLat | cercaliax.service.RoutingStep | undefined

Origin coordinates.

reorder boolean | undefined

Specify if you want to reorder or not the route stops, to get the faster/shorter route. Maximum 10 stop points.

report boolean | undefined

Get the textual route report (if not, gets a faster response). Default 0.

steps Array.<cercalia.LonLat> | Array.<cercaliax.service.RoutingStep> | undefined

Array with stop points coordinates (optional).

tolerance number | undefined

Route geometry generalization, in meters (if =0, returns the original geometry). Default value 5 (meters).

toll boolean | undefined

Specify if you need to get the toll roads cost for the route. Currently only avaliable for Spain, Portugal and Andorra. Default false.

weight string | undefined

Route type: time (faster), distance (shorter), money (toll free route). Default value: time.

vweight number | undefined

Total maximum weight.

vaxleweight number | undefined

Maximum axle weight.

vheight number | undefined

Maximum height.

vlength number | undefined

Maximum length.

vwidth number | undefined

Maximum width.

vmaxvel number | undefined

Maximum speed.

rimp boolean | undefined

Dangerous goods.

departuretime string | undefined

Departure time in format ISO8601

trinfodate string | undefined

YYYYMMDD

trinfodays number | undefined

Number days to consecutives to show restrictions.

trstart number | undefined

Avoid route restrictions. In timestamp format.

originIsDepot boolean | undefined

This parameter only works if REORDER parameter is used. Values:
true (default): origin cannot be reordered (default).
false: origin is one more stop and can be reordered. Useful when you cannot choose the starting point of the vehicle.

destinationIsDepot boolean | undefined

This parameter only works if REORDER parameter is used. Values:
true (default): Destination cannot be reordered (default). false: Destination is one more stop and can be reordered. Useful when after attending some services you don’t have to return to a base.

Extends

Methods

addStep(step)

src/cercalia/service/routing.js, line 297
Name Type Description
step

Step to add.

Name Type Description
streetId string | undefined

Street ID.
For example: Avinguda Diagonal (Barcelona) => ESP080193000092155

streetNum number | undefined

House number

cityId string | undefined

City ID.
For example: Alcalá de Henares (Madrid) => ESP17240205552994

municipalityId string | undefined

Municipality ID. P.e: Madrid => ESP280796

calculateRoute(callbackFn, opt_callbackErrorFn){XMLHttpRequest}

src/cercalia/service/routing.js, line 706

Calcula la ruta especificando una funcion de callback que se ejecuta al volver el resultado

Name Type Description
callbackFn function

Callback Function after calculate route

callbackErrorFn function

Callback Error Function after calculate route error.

Returns:
XMLHttpRequest

clear()

src/cercalia/service/routing.js, line 565

Clear all option values to calculate route.

getClass(){string} inherited

src/cercalia/object.js, line 41
Returns:
Get Class name of object

getDeparturetime(){string|null}

src/cercalia/service/routing.js, line 502
Returns:
Departuretime

getDestination(){cercalia.LonLat|cercaliax.service.RoutingStep}

src/cercalia/service/routing.js, line 289
Returns:
lonLat Get destination

getDestinationIsDepot(){boolean}

src/cercalia/service/routing.js, line 911
Returns:
Get destinationisdepot parameter value.

getEdges(){boolean}

src/cercalia/service/routing.js, line 393
Returns:
edges true or false if edges option is enabled.

getId(){string} inherited

src/cercalia/object.js, line 33
Returns:
Unique Id.

getInfoedges(){boolean}

src/cercalia/service/routing.js, line 417
Returns:
edges true or false if edges option is enabled.

getMindist(){number}

src/cercalia/service/routing.js, line 519
Returns:
Get minimum distance option.

getNumSteps(){number}

src/cercalia/service/routing.js, line 322

Return number of way points.

Returns:
Number of way points.

getOrigin(){cercalia.LonLat|cercaliax.service.RoutingStep}

src/cercalia/service/routing.js, line 264
Returns:
lonLat Get origin

getOriginIsDepot(){boolean}

src/cercalia/service/routing.js, line 894
Returns:
Get originisdepot parameter value.

getPoicats(){Array.<string>}

src/cercalia/service/routing.js, line 433
Returns:
poicats Array of POI categories.

getResponse(){Object}

src/cercalia/service/routing.js, line 849

Get response

Returns:
response

getRouteId(){string|null}

src/cercalia/service/routing.js, line 858

Get Route Id (internal id from Cercalia servers)

Returns:
Cercalia route id

getStages(){Array.<cercaliax.RoutingResultData.Geometry.Route>|null}

src/cercalia/service/routing.js, line 773

Obtiene WKT de la ruta calculada

Returns:
WKT de la ruta calculada. Devuelve null si no se ha calculado ninguna

getSteps(){Array.<cercalia.LonLat>|Array.<cercaliax.service.RoutingStep>}

src/cercalia/service/routing.js, line 313
Returns:
steps

getSubstageWKT(substages, callbackFn)

src/cercalia/service/routing.js, line 785

Obtiene el WKT para las etapas especificadas por parámetro. Anteriormente la ruta debe ser calculada con el parámetro 'report=true'

Name Type Description
substages Array.<string>

Subetapas. p.e: ['1,2', '3,4,5']

callbackFn function

Funcion de callback

getTolerance(){number}

src/cercalia/service/routing.js, line 376
Returns:
tolerance

getToll_x(){string}

src/cercalia/service/routing.js, line 486
Returns:
intoll_x Get ifalculating route using roads with tolls is enabled.

getWeight(){string}

src/cercalia/service/routing.js, line 528

Get route weight time|realtime|money|distance

Returns:
Route weight

getWKT(){string|null}

src/cercalia/service/routing.js, line 763

Obtiene WKT de la ruta calculada

Returns:
WKT de la ruta calculada. Devuelve null si no se ha calculado ninguna

isLogistics(){boolean}

src/cercalia/service/routing.js, line 878
Returns:
true if route has logistics parameters.

isReady(){boolean}

src/cercalia/service/routing.js, line 593

Returns true if it is ready to calculate. When options has been set. (minimum origin and destination)

Returns:
true if can calculate route.

isReorder(){boolean}

src/cercalia/service/routing.js, line 451

Get if reorder options to calculate route is enabled.

Returns:
Reorder true or false.

isReporting(){boolean}

src/cercalia/service/routing.js, line 358
Returns:
report true if report is enabled. Else false.

isToll(){boolean}

src/cercalia/service/routing.js, line 469

Get if toll option is enabled.

Returns:
Toll is true or false.

responseHasReport(){boolean}

src/cercalia/service/routing.js, line 339
Returns:
report true if report is enabled in last route calculated. Else false.

setDeparturetime(departuretime)

src/cercalia/service/routing.js, line 494
Name Type Description
departuretime string | null

Departuretime. Example: 2019-08-26T11:49+02:00-

setDestination(destination)

src/cercalia/service/routing.js, line 274

Set route destination

Name Type Description
destination

Destination

Name Type Description
streetId string | undefined

Street ID.
For example: Avinguda Diagonal (Barcelona) => ESP080193000092155

streetNum number | undefined

House number

cityId string | undefined

City ID.
For example: Alcalá de Henares (Madrid) => ESP17240205552994

municipalityId string | undefined

Municipality ID. P.e: Madrid => ESP280796

setDestinationIsDepot(destinationIsDepot)

src/cercalia/service/routing.js, line 902
Name Type Description
destinationIsDepot boolean

Enable destinationisdepot parameter

setEdges(edges)

src/cercalia/service/routing.js, line 385

Set to get edges from route calculation.

Name Type Description
edges number

Edges options enabled true. Else false.

setInfoedges(infoedges)

src/cercalia/service/routing.js, line 409

Adds specific information for each section to the route report.
An infoedges tag is added to each substage with specific information of each section.
The following attributes are reported for each section:
height: height from sea level in meters.
gradient: slope of the section
geometry: Stretch geometry
meters: Length of the section
maxkph: Legal maximum speed

Name Type Description
infoedges boolean

Enable true. Else false.

setLogistics(isLogistics)

src/cercalia/service/routing.js, line 870
Name Type Description
isLogistics boolean

Enable logistic route.

setLogisticsParams(logisticsParams)

src/cercalia/service/routing.js, line 545
Name Type Description
logisticsParams

Logistics params.

Name Type Description
vaxleweight number | undefined

Maximum axle weight.

vheight number | undefined

Maximum height.

vlength number | undefined

Maximum length.

vwidth number | undefined

Maximum width.

vmaxvel number | undefined

Maximum speed.

rimp boolean | undefined

Dangerous goods.

trinfodate string | undefined

YYYYMMDD

trinfodays number | undefined

Number days to consecutives to show restrictions.

trstart number | undefined

Avoid route restrictions. In timestamp format.

setMindist(mindist)

src/cercalia/service/routing.js, line 511

Set minimum distance option.

Name Type Description
mindist number

Minimum distance

setOrigin(origin)

src/cercalia/service/routing.js, line 249

Set route origin

Name Type Description
origin

Origin

Name Type Description
streetId string | undefined

Street ID.
For example: Avinguda Diagonal (Barcelona) => ESP080193000092155

streetNum number | undefined

House number

cityId string | undefined

City ID.
For example: Alcalá de Henares (Madrid) => ESP17240205552994

municipalityId string | undefined

Municipality ID. P.e: Madrid => ESP280796

setOriginIsDepot(originIsDepot)

src/cercalia/service/routing.js, line 886
Name Type Description
originIsDepot boolean

Enable originisdepot parameter

setPoicats(poicats)

src/cercalia/service/routing.js, line 425
Name Type Description
poicats Array.<string>

Array of POI categories.

setReorder(reorder)

src/cercalia/service/routing.js, line 442

Enable calculation route reorder points in calculation.

Name Type Description
reorder boolean

true or false.

setReporting(reporting)

src/cercalia/service/routing.js, line 331

Enable route report.

Name Type Description
reporting boolean

Boolean to enable route report. (First need to calculate route).

setSteps(steps)

src/cercalia/service/routing.js, line 305
Name Type Description
steps Array.<cercalia.LonLat> | Array.<cercaliax.service.RoutingStep>

Steps array.

setTolerance(tolerance)

src/cercalia/service/routing.js, line 367

Route tolerance

Name Type Description
tolerance number

Tolerance

setToll(toll)

src/cercalia/service/routing.js, line 460

Enable tolls in route calculation.

Name Type Description
toll boolean

true or false.

setToll_x(intoll_x)

src/cercalia/service/routing.js, line 478
Name Type Description
intoll_x string

Calculating route using roads with tolls.

setWeight(weight)

src/cercalia/service/routing.js, line 537

Set weight to calculate route. Weight values available: time|realtime|money|distance

Name Type Description
weight string

Weight. time|realtime|money|distance