Class: Routing

cercalia.service.Routing

new cercalia.service.Routing(options)

Constructor del servei Service Routing

Name Type Description
options
Name Type Description
destination cercalia.LonLat | cercaliax.service.RoutingStep

Destination coordinates.

lang string

Report language (only if report=true).

mindist boolean | undefined optional

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

origin cercalia.LonLat | cercaliax.service.RoutingStep

Origin coordinates.

reorder boolean | undefined optional

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

report boolean | undefined optional

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

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

Array with stop points coordinates (optional).

tolerance number | undefined optional

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

toll boolean | undefined optional

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

weight string | undefined optional

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

Methods

calculateRoute(callbackFn, callbackErrorFn)

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

Name Type Description
callbackFn function
callbackErrorFn function

Reinicializa los valores a null

clone cercalia.service.LogisticsRouting to cercalia.service.Routing

Name Type Description
service cercalia.service.LogisticsRouting
Returns:
async

Get classname of object

Returns:
lonLat Final de la ruta
Returns:
edges
Returns:
toll
Returns:
lonLat Inicio de la ruta
Returns:
poicats

Get response

Returns:
response

Obtains route WKT (polyline)

Returns:
Route WKT. Returns null if no route is calculated

Obtiene WKT de la ruta calculada

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

getSubstageWKT(substages, callbackFn)

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

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

callbackFn function

Funcion de callback

Returns:
tolerance
Returns:
toll
Returns:
intoll_x

Devuelve el weight de la ruta actual.

Returns:
Route weight

Obtains route WKT (polyline)

Returns:
Route WKT. Returns null if no route is calculated

Obtiene WKT de la ruta calculada

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

Cambia la peticion al servidor de ruta de forma sincrona (false) /asincrona (true).

Name Type Description
async boolean

Indica inicio ruta

Name Type Description
destination
Name Type Description
streetId string | undefined optional

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

streetNum number | undefined optional

House number

cityId string | undefined optional

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

municipalityId string | undefined optional

Municipality ID. P.e: Madrid => ESP280796

Indica si se devolveran los edges de la ruta

Name Type Description
edges number
Name Type Description
mindist boolean

setOptionsToLogisticsService(logisticsService)

clone cercalia.service.Routing to cercalia.service.LogisticsRouting

Name Type Description
logisticsService cercalia.service.LogisticsRouting

Indica inicio ruta

Name Type Description
origin
Name Type Description
streetId string | undefined optional

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

streetNum number | undefined optional

House number

cityId string | undefined optional

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

municipalityId string | undefined optional

Municipality ID. P.e: Madrid => ESP280796

Name Type Description
poicats Array.<string>
Name Type Description
reorder boolean

Indica inicio ruta

Name Type Description
reporting boolean
Name Type Description
steps Array.<cercalia.LonLat> | Array.<cercaliax.service.RoutingStep>

Indica la tolerancia de la ruta

Name Type Description
tolerance number
Name Type Description
toll boolean
Name Type Description
intoll_x String

Cambia el weight del caclulo de la ruta.

Name Type Description
async string