-
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.
origin
module:cercaliagl/LonLat~LonLat Origin. If not defined, then use
setOrigin
to initialize variable;destination
module:cercaliagl/LonLat~LonLat Destination. If not defined, then use
setDestination
to initialize variable;steps
Array.<module:cercaliagl/LonLat~LonLat> Sequential stop list.
weight
string | undefined Distance calculation considering weight/type
line|time|distance|money
. Default valueline
.
Extends
- module:cercaliagl/service/Service~Service
Methods
-
module:cercaliagl/service/Distance~Distance.calculateDistanceOnArea(area){number}
-
Name Type Description area
GeoJSON Returns:
Distance in quare meters
-
module:cercaliagl/service/Distance~Distance.calculateDistanceOnLine(line, units){number}
-
Name Type Description line
GeoJSON LineString || MultiLineString
units
string Kilometers || miles || radians || degrees. Kilometers by default
Returns:
Distance in the specified units
-
Distance calculation with the assigned parameters, and returns the data to the callback function which is called once server returns response.
Name Type Description callbackFn
function Callback function
-
Returns the destination.
Returns:
Destination point
-
Obtain origin.
Returns:
Returns the origin assigned previously
-
Get steps (or waypoints)
Returns:
Steps
-
Get weight. Available values
line|time|distance|money
Returns:
weight
-
Returns if calculate geometry functionality is active or inactive
Returns:
calculateGeometrytrue
orfalse
. If calculate geometry option is enabled.
-
Name Type Description calculateGeometry
boolean true
if geometry will be returned after calculation.. -
Set destination point.
Name Type Description lonLat
module:cercaliagl/LonLat~LonLat Destination point
-
Set origin point.
Name Type Description lonLat
module:cercaliagl/LonLat~LonLat Origin point
-
Set steps (or waypoints)
Name Type Description steps
Array.<module:cercaliagl/LonLat~LonLat> Array with steps
-
Set weight to calculate distance
Name Type Description weight
string Weight. Available values
line|time|distance|money