• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places




getSnapToRoads(opt: SnapToRoadsRequest)


  1. opt: SnapToRoadsRequest

Return Value: Promise

Interface SnapToRoadsRequest


approaches Optional

Type: Array<ApproachType>

A semicolon-separated list indicating the side of the road from which to approach waypoints in a requested route. If provided, the number of approaches must be one more than the number of waypoints.
avoid Optional

Type: AvoidType

Setting this will ensure the route avoids ferry, tolls or highways.
geometry Optional

Type: GeometryType

Sets the output format of the route geometry in the response.If geojson is selected, the response will include geometry in polyline6 format and will also include a geojson object that defines the route polyline. Default: polyline6
interpolate Optional

Type: boolean

Enable to interpolate the path. Default: false Note: might return more points
mode Optional

Type: string

A parameter which which sets the transportation mode for the route. PS: Only the 4w/car profile is enabled by default. The other customised routing profiles are only supported in premium plan.

Type: Array<LngLatLike>

Pipe separated list of points along a path on which a snap to road will be done. The default maximum limit is 200
radiuses Optional

Type: Array<number>

Pipe separated Radiuses of each location for performing snap to road. Unit: meters
timestamps Optional

Type: Array<number>

Pipe separated unix timestamps for each location. Unit: seconds
tolerateOutlier Optional

Type: boolean

enable to ignore location not found in service boundary.
Note: enable this to ignore outliers, otherwise an error will be thrown.
Default: false

Interface SnapToRoadsResult

Interface SnapToRoadsResponsePoint



Type: number

Bearing angle of the snapped point.

Type: number

Distance of the snapped point from the original.

Type: { latitude: number,longitude: number }

Latitude and longitude.

Type: string

Name of the street the coordinate snapped to.

Type: number

Index of original input array.

Constants ApproachType

CURBroute will arrive at the waypoint on the driving_side of the region
UNRESTRICTEDroute can arrive at the waypoint from either side of the road

Constants AvoidType

FERRYAvoid ferry in route.
HIGHWAYAvoid highway in route.
TOLLAvoid toll in route.

Constants TravelMode

The transportation mode for the route.

AUTOdefault mode, same as car or 4w
BICYCLINGbike mode
DRIVINGcar mode
FOUR_WHEELSfour wheels mode
SCOOTERscooter mode
TWO_WHEELstwo wheels mode
WALKINGwalk mode

Constants GeometryType

Output format of the route geometry.

GEOJSONGeojson format geometry.
POLYLINEPolyline format geometry.
POLYLINE_6Polyline6 format geometry.