Class: Distance

cercalia.service.Distance

Class designed for route calculation.

new cercalia.service.Distance(options)

Name Type Description
options

Params and options for distance calculation

Name Type Description
calculateGeometry Boolean

Specify if you need to obtain the shape geometry when calculating the distance. For weight=='line' this option is not avaliable.

destination cercalia.LonLat

Destination.

origin cercalia.LonLat

Origin.

steps Array.<cercalia.LonLat>

Sequential stop list.

weight string

Distance calculation considering weight/type (line|time|distance|money|undefined). Default value line.

Methods

Distance calculation with the assigned parameters, and returns the data to the callback function specified by parameter by the user.

Name Type Description
callbackFn function

callback funcion

Returns the object type.

Returns:
Returns the destination assigned previously
Returns:
Returns the origin assigned previously
Returns:
destination

Values = [line|time|distance|money]

Returns:
weight

Returns if calculate geometry function it's on or off

Returns:
calculateGeometry

setCalculateGeometry(calculateGeometry)

Name Type Description
calculateGeometry boolean
Name Type Description
lonLat cercalia.LonLat

Destination

Name Type Description
lonLat cercalia.LonLat

Assign the origin of distance calculation

Name Type Description
steps Array.<cercalia.LonLat>

Array with steps

Name Type Description
weight string