目录

navi (Route Planning)

This module provides the route planning function.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

Start version: 4.1.0(11)

Module Import

import { navi } from '@kit.MapKit';

This module provides the methods described in the following table to implement route planning, batch route computation, and trajectory-based road snapping capabilities.

Name

Description

getDrivingRoutes(params: DrivingRouteParams)

Plans driving routes.

getDrivingRoutes(context: common.Context, params: DrivingRouteParams)

Plans driving routes. The context can be passed.

getWalkingRoutes(params: RouteParams)

Plans walking routes.

getWalkingRoutes(context: common.Context, params: RouteParams)

Plans walking routes. The context can be passed.

getCyclingRoutes(params: RouteParams)

Plans cycling routes.

getCyclingRoutes(context: common.Context, params: RouteParams)

Plans cycling routes. The context can be passed.

getDrivingMatrix(params: DrivingMatrixParams)

Performs batch route computation for driving.

getDrivingMatrix(context: common.Context, params: DrivingMatrixParams)

Performs batch route computation for driving. The context can be passed.

getWalkingMatrix(params: MatrixParams)

Performs batch route computation for walking.

getWalkingMatrix(context: common.Context, params: MatrixParams)

Performs batch route computation for walking. The context can be passed.

getCyclingMatrix(params: MatrixParams)

Performs batch route computation for cycling.

getCyclingMatrix(context: common.Context, params: MatrixParams)

Performs batch route computation for cycling. The context can be passed.

snapToRoads(params: SnapToRoadsParams)

Performs trajectory-based road snapping.

snapToRoads(context: common.Context, params: SnapToRoadsParams)

Performs trajectory-based road snapping. The context can be transferred.

This module provides the classes or APIs described in the following table to implement route planning, batch route computation, and trajectory-based road snapping capabilities.

Name

Type

Description

RouteCoordinate

RouteCoordinate

Defines route planning attributes.

RouteParams

RouteParams

Defines parameters for planning walking and cycling routes.

RouteResult

RouteResult

Defines the route planning result.

DrivingRouteParams

DrivingRouteParams

Defines parameters for planning driving routes.

Route

Route

Defines planned routes from the departure place to the destination.

RouteStep

RouteStep

Defines road planning information.

RouteRoad

RouteRoad

Defines route section information.

CoordinateBound

CoordinateBound

Defines route bounds.

Waypoint

Waypoint

Defines waypoint information.

TrafficSegment

TrafficSegment

Defines traffic information.

MatrixParams

MatrixParams

Defines parameters for batch walking and cycling route computation.

MatrixResult

MatrixResult

Defines the result of batch route computation.

DrivingMatrixParams

DrivingMatrixParams

Defines parameters for batch driving route computation.

MatrixRow

MatrixRow

Defines distances and journey time of routes between departure places and destinations.

MatrixCell

MatrixCell

Defines information about each element in the distance matrix.

SnapToRoadsParams

SnapToRoadsParams

Defines parameters for trajectory-based road snapping.

SnapToRoadsResult

SnapToRoadsResult

Defines the trajectory-based road snapping result.

SnappedPoint

SnappedPoint

Defines road snapping points.

getDrivingRoutes

getDrivingRoutes(params: DrivingRouteParams): Promise<RouteResult>

Plans the driving routes between two locations. This API returns the result asynchronously through a promise.

  • A maximum of three routes can be returned for each API call.
  • You can specify up to 5 waypoints.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

DrivingRouteParams

Yes

Parameters for planning driving routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.DrivingRouteParams = {
  origins: [{
    "latitude": 31.9821213545843,
    "longitude": 120.27745557768591
  }],
  destination: {
    "latitude": 31.983545843,
    "longitude": 120.27745557768591
  },
  waypoints: [
    { "latitude": 31.967236140819114, "longitude": 120.27142088866847 },
    { "latitude": 31.972868002238872, "longitude": 120.2943211817165 },
    { "latitude": 31.98469327973332, "longitude": 120.29101107384068 }
  ],
  language: "zh_CN"
};
const result = await navi.getDrivingRoutes(params);
console.info("Succeeded in getting driving routes.");

getDrivingRoutes

getDrivingRoutes(context: common.Context, params: DrivingRouteParams): Promise<RouteResult>

Plans the driving routes between two locations. The context can be passed. This API returns the result asynchronously through a promise.

  • A maximum of three routes can be returned for each API call.
  • You can specify up to 5 waypoints.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

DrivingRouteParams

Yes

Parameters for planning driving routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.DrivingRouteParams = {
  origins: [{
    "latitude": 31.982129213545843,
    "longitude": 120.27745557768591
  }],
  destination: {
    "latitude": 31.9821213545843,
    "longitude": 120.277557768591
  },
  waypoints: [
    { "latitude": 31.967236140819114, "longitude": 120.27142088866847 },
    { "latitude": 31.972868002238872, "longitude": 120.2943211817165 },
    { "latitude": 31.98469327973332, "longitude": 120.29101107384068 }
  ],
  language: "zh_CN"
};
const result = await navi.getDrivingRoutes(getContext(), params);
console.info("Succeeded in getting driving routes.");

getWalkingRoutes

getWalkingRoutes(params: RouteParams): Promise<RouteResult>

Plans the walking routes between two locations. This API returns the result asynchronously through a promise.

Walking route planning is limited to two locations within a straight-line distance of 150 kilometers.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

RouteParams

Yes

Parameters for planning walking routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.RouteParams = {
  origins: [
    { "latitude": 39.992281, "longitude": 116.31088 },
    { "latitude": 39.996, "longitude": 116.311 }
  ],
  destination: {
    "latitude": 39.94,
    "longitude": 116.311
  },
  language: "zh_CN"
};
const result = await navi.getWalkingRoutes(params);
console.info("Succeeded in getting walking routes.");

getWalkingRoutes

getWalkingRoutes(context: common.Context, params: RouteParams): Promise<RouteResult>

Plans the walking routes between two locations. The context can be passed. This API returns the result asynchronously through a promise.

Walking route planning is limited to locations within a straight-line distance of 150 kilometers.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

RouteParams

Yes

Parameters for planning walking routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.DrivingRouteParams = {
  origins: [{
    "latitude": 31.982129213545843,
    "longitude": 120.27745557768591
  }],
  destination: {
    "latitude": 31.9821213545843,
    "longitude": 120.277557768591
  },
  waypoints: [
    { "latitude": 31.967236140819114, "longitude": 120.27142088866847 },
    { "latitude": 31.972868002238872, "longitude": 120.2943211817165 },
    { "latitude": 31.98469327973332, "longitude": 120.29101107384068 }
  ],
  language: "zh_CN"
};
const result = await navi.getWalkingRoutes(getContext(), params);
console.info("Succeeded in getting walking routes.");

getCyclingRoutes

getCyclingRoutes(params: RouteParams): Promise<RouteResult>

Plans the cycling routes between two locations. This API returns the result asynchronously through a promise.

Cycling route planning is limited to locations within a straight-line distance of 500 kilometers.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

RouteParams

Yes

Parameters for planning cycling routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.RouteParams = {
  origins: [{
    latitude: 31.984410259206815,
    longitude: 118.76625379397866
  }],
  destination: {
    latitude: 30.9844259206815,
    longitude: 119.766259397866
  },
  language: "zh_CN"
};
const result = await navi.getCyclingRoutes(params);
console.info("Succeeded in getting cycling routes.");

getCyclingRoutes

getCyclingRoutes(context: common.Context, params: RouteParams): Promise<RouteResult>

Plans the cycling routes between two locations. The context can be passed. This API returns the result asynchronously through a promise.

Cycling route planning is limited to locations within a straight-line distance of 500 kilometers.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

RouteParams

Yes

Parameters for planning cycling routes.

Returns:

Type

Description

Promise<RouteResult>

RouteResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.RouteParams = {
  origins: [{
    latitude: 31.98441059206815,
    longitude: 118.76625379397866
  }],
  destination: {
    latitude: 30.984410259206815,
    longitude: 119.766259397866
  },
  language: "zh_CN"
};
const result = await navi.getCyclingRoutes(getContext(), params);
console.info("Succeeded in getting cycling routes.");

getDrivingMatrix

getDrivingMatrix(params: DrivingMatrixParams): Promise<MatrixResult>

Plans the driving routes between multiple locations. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as ride-hailing order dispatching. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Driving route planning is limited to locations within a straight-line distance of 2000 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

DrivingMatrixParams

Yes

Parameters for batch driving route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.DrivingMatrixParams = {
  "origins": [
    {
      latitude: 31.9844159206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.184410259206815,
      longitude: 118.366379397866
    }
  ],
  "destinations": [{
    latitude: 30.98441259206815,
    longitude: 119.765379397866
  }],
  "trafficMode": 2,
  "language": "zh_CN"
};
const result = await navi.getDrivingMatrix(params);
console.info("Succeeded in getting driving matrix.");

getDrivingMatrix

getDrivingMatrix(context: common.Context, params: DrivingMatrixParams): Promise<MatrixResult>

Plans the driving routes between multiple locations. The context can be passed. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as ride-hailing order dispatching. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Driving route planning is limited to locations within a straight-line distance of 2000 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

DrivingMatrixParams

Yes

Parameters for batch driving route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.DrivingMatrixParams = {
  "origins": [
    {
      latitude: 31.984410259206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.904410259206815,
      longitude: 118.70625379397866
    }
  ],
  "destinations": [{
    latitude: 30.9844109206815,
    longitude: 119.765379397866
  }],
  "trafficMode": 2,
  "language": "zh_CN"
};
const result = await navi.getDrivingMatrix(getContext(), params);
console.info("Succeeded in getting driving matrix.");

getWalkingMatrix

getWalkingMatrix(params: MatrixParams): Promise<MatrixResult>

Plans the walking routes between multiple locations. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as package delivery. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Walking route planning is limited to locations within a straight-line distance of 150 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

MatrixParams

Yes

Parameters for batch walking route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.MatrixParams = {
  "origins": [
    {
      latitude: 31.984410259206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.904410259206815,
      longitude: 118.70625379397866
    }
  ],
  "destinations": [{
    latitude: 30.9844259206815,
    longitude: 119.765379397866
  }],
  "language": "zh_CN"
};
const result = await navi.getWalkingMatrix(params);
console.info("Succeeded in getting walking matrix.");

getWalkingMatrix

getWalkingMatrix(context: common.Context, params: MatrixParams): Promise<MatrixResult>

Plans the walking routes between multiple locations. The context can be passed. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as package delivery. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Walking route planning is limited to locations within a straight-line distance of 150 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

MatrixParams

Yes

Parameters for batch walking route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.MatrixParams = {
  "origins": [
    {
      latitude: 31.984410259206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.904410259206815,
      longitude: 118.70625379397866
    }
  ],
  "destinations": [{
    latitude: 30.9810259206815,
    longitude: 119.765379397866
  }],
  "language": "zh_CN"
};
const result = await navi.getWalkingMatrix(getContext(), params);
console.info("Succeeded in getting walking matrix.");

getCyclingMatrix

getCyclingMatrix(params: MatrixParams): Promise<MatrixResult>

Plans the cycling routes between multiple locations. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as package delivery. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Cycling route planning is limited to locations within a straight-line distance of 500 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

MatrixParams

Yes

Parameters for batch cycling route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.MatrixParams = {
  "origins": [
    {
      latitude: 31.984410259206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.904410259206815,
      longitude: 118.70625379397866
    }
  ],
  "destinations": [{
    latitude: 30.9841259206815,
    longitude: 119.766239397866
  }],
  "language": "zh_CN"
};
const result = await navi.getCyclingMatrix(params);
console.info("Succeeded in getting cycling matrix.");

getCyclingMatrix

getCyclingMatrix(context: common.Context, params: MatrixParams): Promise<MatrixResult>

Plans the cycling routes between multiple locations. The context can be passed. This API returns the result asynchronously through a promise.

This function is suitable for high-concurrency scenarios, such as package delivery. In this context, the function performs a batch calculation for a single request, obtaining the route distance and journey time between multiple departure places and destinations.

1. Cycling route planning is limited to locations within a straight-line distance of 500 kilometers.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

MatrixParams

Yes

Parameters for batch cycling route computation.

Returns:

Type

Description

Promise<MatrixResult>

MatrixResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.MatrixParams = {
  "origins": [
    {
      latitude: 31.984410259206815,
      longitude: 118.76625379397866
    },
    {
      latitude: 31.904410259206815,
      longitude: 118.70625379397866
    }
  ],
  "destinations": [{
    latitude: 30.98259206815,
    longitude: 119.7679397866
  }],
  "language": "zh_CN"
};
const result = await navi.getCyclingMatrix(getContext(), params);
console.info("Succeeded in getting cycling matrix.");

snapToRoads

snapToRoads(params: SnapToRoadsParams): Promise<SnapToRoadsResult>

Captures roads based on specified coordinate points to align the user trajectory to the most likely roads that a vehicle was traveling along, and returns a set of coordinate points on the roads. This API returns the result asynchronously through a promise.

The number of coordinate points cannot exceed 100, and the distance between two adjacent coordinate points cannot be greater than 500 meters.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Mandatory

Description

params

SnapToRoadsParams

Yes

Parameters for trajectory-based road snapping.

Returns:

Type

Description

Promise<SnapToRoadsResult>

SnapToRoadsResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.SnapToRoadsParams = {
  points: [{
    latitude: 31.984410259206815,
    longitude: 118.76625379397866
  }]
};
const result = await navi.snapToRoads(params);
console.info("Succeeded in snapping to roads.");

snapToRoads

snapToRoads(context: common.Context, params: SnapToRoadsParams): Promise<SnapToRoadsResult>

Captures roads based on specified coordinate points to align the user trajectory to the most likely roads that a vehicle was traveling along, and returns a set of coordinate points on the roads. The context can be passed. This API returns the result asynchronously through a promise.

The number of coordinate points cannot exceed 100, and the distance between two adjacent coordinate points cannot be greater than 500 meters.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 5.0.0(12).

System capability: SystemCapability.Map.Core

Start version: 5.0.0(12)

Parameters:

Name

Type

Mandatory

Description

context

common.Context

Yes

Context.

params

SnapToRoadsParams

Yes

Parameters for trajectory-based road snapping.

Returns:

Type

Description

Promise<SnapToRoadsResult>

SnapToRoadsResult object returned through a promise.

Error codes:

For details about the error codes, please refer to ArkTS API Error Codes.

Error Code

Error Message

401

Invalid input parameter.

1002600001

System internal error.

1002600002

Failed to connect to the Map Kit server.

1002600003

App authentication failed.

1002600004

The Map permission is not enabled.

1002600006

The API call times exceed the quota.

1002600007

The API QPS exceeds the quota.

1002600008

The API is in arrears.

1002600009

The API has not subscribed to any pay-as-you-go package.

1002600010

The server is busy. Please wait and try again.

1002600011

Server error.

1002600999

Unknown error.

1002602001

The start and end points do not have home countries, or a service error occurred.

1002602002

Cross-region route planning is not supported.

1002602003

The number of start points or end points exceed 100.

1002602004

The linear distance between the start point and end point exceeds the upper limit.

1002602005

The start point, end point, or waypoint does not support navigation.

1002602006

The request point is mapped to the same point on the road.

Example:
let params: navi.SnapToRoadsParams = {
  points: [{
    latitude: 31.984410259206815,
    longitude: 118.76625379397866
  }]
};
const result = await navi.snapToRoads(getContext(), params);
console.info("Succeeded in snapping to roads.");

RouteCoordinate

Defines route planning attributes.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

matchType

number

No

Yes

Road snapping type of the departure place and destination.

The options are 0 (default), 1, and 3.

  • 0: restricted snapping. Departure places are not snapped to closed roads, roads under construction, traffic restricted roads, and roads set to avoid, and destinations are not snapped to highways, ferries, and roads set to avoid.
  • 1: unlimited snapping.
  • 3: trajectory-based snapping. You can pass the longitude-latitude coordinates of consecutive trajectory points in the origins parameter for unlimited snapping. This value is supported only for the departure place.

latitude

number

No

No

Latitude. The value ranges from –90 to 90.

longitude

number

No

No

Longitude. The value ranges from –180 to 180 (excluded).

accuracy

number

No

Yes

GPS location accuracy, in meters.

altitude

number

No

Yes

Altitude, in meters.

bearing

number

No

Yes

Deviation angle.

0 degrees is due north, and angles increase clockwise. The value range is [0, 360). The default value is 0. Values that fall outside the valid range will be adjusted to values within the range. For instance, the value 361 would be converted to 1, and the value -1 would be converted to 359.

speed

number

No

Yes

Current driving speed, in meters per second.

timestamp

number

No

Yes

Timestamp of the current location generation time.

RouteParams

Defines parameters for planning walking and cycling routes.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

origins

Array<RouteCoordinate>

No

No

Departure place coordinate list for road snapping. The last coordinate is the actual departure place.

The number of coordinate points cannot exceed 31, and the distance between two adjacent coordinate points must be greater than 1 meter.

destination

RouteCoordinate

No

No

Destination.

language

string

No

Yes

Language of text instructions/descriptions. Currently, only zh_CN (Chinese) and en (English) are supported. If this parameter is not set, the local language will be used.

avoids

Array<number>

No

Yes

Specified policy for calculating routes. The options are as follows:

  • 0: Fastest route.
  • 1: Avoid toll roads.
  • 2: Avoid highways.
  • 4: Shortest distance.
  • 8: Avoid ferries.
  • 16: Avoid congested roads.
  • 32: Prioritize major roads.
  • 64: Smart route.
  • 128: Prioritize highways.
  • 256: Minimize tolls.
  • 512: Smooth speed.

The default value is 0.

Only two policies are supported for walking and cycling route planning: 0 and 8.

Currently, values 16, 32, 128, and 256 are supported only for route planning within the Chinese mainland, and they will be gradually supported in other countries and regions in the future.

NOTE:

Only policy 1 (Avoid toll roads) and policy 8 (Avoid ferries) can be combined for route planning.

extension

number

No

Yes

Additional information.

  • 0: basic traffic condition
  • 1: new traffic condition

The default value is 0.

RouteResult

Defines the route planning result.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

routes

Array<Route>

No

No

Planned routes from the departure place to the destination. If no routes are available, an empty array will be returned.

DrivingRouteParams

Defines parameters for planning driving routes. This API inherits from RouteParams.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

waypoints

Array<mapCommon.LatLng>

No

Yes

Waypoints. You can specify up to 5 waypoints.

isViaType

boolean

No

Yes

Waypoint type.

  • false: stopover (default value)
  • true: via
    NOTE:

    1. The stopover type indicates a stopping point. The route information will be sent by segment.

    2. The via type indicates a pass-by point. The entire route information will be sent.

optimize

boolean

No

Yes

Indicates whether to optimize a waypoint.

  • false: no
  • true: yes

The default value is false.

alternatives

boolean

No

Yes

Indicates whether to return multiple planned routes.

  • true: yes
  • false: no (Only one planned route is returned.)

The default value is false.

departAt

number

No

Yes

Estimated departure time, in seconds since 00:00:00 on January 1, 1970 (UTC).

The value must be the current time or a future time.

NOTE:

If departAt is set to 0, the current time is used.

trafficMode

number

No

Yes

Time estimation mode. The options are as follows:

  • 0: Intelligent prediction.
  • 1: Traffic conditions are worse than the historical average.
  • 2: Traffic conditions are better than the historical average.

The default value is 0.

Route

Defines planned routes from the departure place to the destination.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

steps

Array<RouteStep>

No

No

Route planning information.

overviewPolyline

Array<mapCommon.LatLng>

No

Yes

Longitude and latitude of the encoded MapPolyline of a route.

optimizedWaypoints

Array<number>

No

Yes

Index of an optimized waypoint. This parameter is available only when isViaType is set to false and optimize is set to true.

bounds

Array<CoordinateBound>

No

Yes

Route bounds.

trafficLightCount

number

No

Yes

Number of traffic lights.

isDestinationInRestrictedArea

boolean

No

Yes

Indicates whether the destination is in a restricted area.

  • true: yes
  • false: no

isDestinationInDiffTimeZone

boolean

No

Yes

Indicates whether the time zone of the destination is different from that of the departure place.

  • true: yes
  • false: no

isCrossCountry

boolean

No

Yes

Indicates whether the route crosses a country boundary.

  • true: yes
  • false: no

isCrossMultiCountries

boolean

No

Yes

Indicates whether the route crosses multiple country boundaries.

  • true: yes
  • false: no

hasRestrictedRoad

boolean

No

Yes

Indicates whether the route includes private or restricted roads.

  • true: yes
  • false: no

hasRoughRoad

boolean

No

Yes

Indicates whether the route includes rough roads.

  • true: yes
  • false: no

hasFerry

boolean

No

Yes

Indicates whether the route includes ferry.

  • true: yes
  • false: no

hasTolls

boolean

No

Yes

Indicates whether the route includes toll gates.

  • true: yes
  • false: no

hasStairs

boolean

No

Yes

Indicates whether the route has stairs.

  • true: yes
  • false: no

RouteStep

Defines road planning information.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

roads

Array<RouteRoad>

No

No

Route section information.

startLocation

mapCommon.LatLng

No

No

Longitude and latitude of the departure place.

startAddress

string

No

Yes

Detailed address of the departure place.

endLocation

mapCommon.LatLng

No

No

Longitude and latitude of the destination.

endAddress

string

No

Yes

Detailed address of the destination.

viaWaypoints

Array<Waypoint>

No

Yes

Waypoint information.

distance

number

No

Yes

Driving/Walking/Cycling distance, in meters.

distanceDescription

string

No

Yes

Distance description.

duration

number

No

Yes

Driving/Walking/Cycling duration, in seconds.

durationDescription

string

No

Yes

Duration description.

durationInTraffic

number

No

Yes

Driving/Walking/Cycling duration calculated based on the real-time traffic condition, in seconds.

durationInTrafficDescription

string

No

Yes

Description of the driving/walking/cycling duration calculated based on the real-time traffic condition.

RouteRoad

Defines route section information.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

startLocation

mapCommon.LatLng

No

No

Longitude and latitude of the departure place.

endLocation

mapCommon.LatLng

No

No

Longitude and latitude of the destination.

polyline

Array<mapCommon.LatLng>

No

No

A series of coordinate points on a route section (including coordinates of the departure place and destination).

distance

number

No

No

Driving/Walking/Cycling distance, in meters.

distanceDescription

string

No

Yes

Distance description.

duration

number

No

No

Driving/Walking/Cycling duration, in seconds.

durationDescription

string

No

Yes

Duration description.

roadName

string

No

Yes

Road name.

action

string

No

Yes

Operation to be performed in the current step. The options are as follows:

  • turn_slight_left: Slightly turn left.
  • turn_sharp_left: Sharply turn left.
  • turn_left: Turn left
  • turn_slight_right: Slightly turn right.
  • turn_sharp_right: Sharply turn right.
  • turn_right: Turn right.
  • straight: Go straight.
  • end: End point.
  • waypoint: Waypoint.

orientation

number

No

Yes

Road direction. The options are as follows:

  • 0: bidirectional
  • 1: forward direction
  • 2: reverse direction

instruction

string

No

Yes

Text instruction.

trafficSegments

Array<TrafficSegment>

No

Yes

Traffic information.

CoordinateBound

Defines route bounds.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

northeast

mapCommon.LatLng

No

No

Coordinates of the northeast corner.

southwest

mapCommon.LatLng

No

No

Coordinates of the southwest corner.

Waypoint

Defines waypoint information.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

location

mapCommon.LatLng

No

No

Longitude and latitude of a waypoint.

stepIndex

number

No

No

Waypoint index in the roads array.

TrafficSegment

Defines traffic information.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

distance

number

No

No

Driving/Walking/Cycling distance, in meters.

status

number

No

No

Traffic status. The options are as follows:

  • 0: unknown
  • 1: smooth
  • 2: slow
  • 3: congested
  • 4: extremely congested

polyline

Array<mapCommon.LatLng>

No

No

Road section shape coordinates.

MatrixParams

Defines parameters for batch walking and cycling route computation.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

origins

Array<RouteCoordinate>

No

No

Longitudes and latitudes of the departure places. A maximum of 100 values are allowed.

destinations

Array<RouteCoordinate>

No

No

Longitudes and latitudes of the destinations. A maximum of 100 values are allowed.

NOTE:

1. Driving route planning, walking route planning, and cycling route planning are limited to locations within a straight-line distance of 2000 kilometers, 150 kilometers, and 500 kilometers, respectively.

2. The number of departure places multiplied by the number of destinations cannot exceed 100.

language

string

No

Yes

Language of text instructions/descriptions. Currently, only zh_CN (Chinese) and en (English) are supported. If this parameter is not set, the local language will be used.

avoids

Array<number>

No

Yes

Specified policy for calculating routes. The options are as follows:

  • 0: Fastest route.
  • 1: Avoid toll roads.
  • 2: Avoid highways.
  • 4: Shortest distance.
  • 8: Avoid ferries.
  • 16: Avoid congested roads.
  • 32: Prioritize major roads.
  • 64: Smart route.
  • 128: Prioritize highways.
  • 256: Minimize tolls.

The default value is 0.

Only two policies are supported for walking and cycling route planning: 0 and 8.

All values are supported for driving route planning. Currently, values 16, 32, 128, and 256 are supported only for route planning within the Chinese mainland, and they will be gradually supported in other countries and regions in the future.

MatrixResult

Defines the result of batch route computation.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

originAddresses

Array<string>

No

No

Detailed address of the departure place.

destinationAddresses

Array<string>

No

No

Detailed address of the destination.

rows

Array<MatrixRow>

No

No

Distances and journey time of routes between departure places and destinations.

DrivingMatrixParams

Defines parameters for batch driving route computation. This API inherits from MatrixParams.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

departAt

number

No

Yes

Estimated departure time, in seconds since 00:00:00 on January 1, 1970 (UTC).

The value must be the current time or a future time.

NOTE:

If departAt is set to 0, the current time is used.

trafficMode

number

No

Yes

Time estimation mode. The options are as follows:

  • 0: best guess (default value).
  • 1: Traffic conditions are worse than the historical average.
  • 2: Traffic conditions are better than the historical average.

The default value is 0.

MatrixRow

Defines distances and journey time of routes between departure places and destinations.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

cells

Array<MatrixCell>

No

No

Information about each element in the distance matrix.

MatrixCell

Defines information about each element in the distance matrix.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

distance

number

No

Yes

Driving/Walking/Cycling distance, in meters.

distanceDescription

string

No

Yes

Distance description.

duration

number

No

Yes

Driving/Walking/Cycling duration, in seconds.

durationDescription

string

No

Yes

Duration description.

SnapToRoadsParams

Defines parameters for trajectory-based road snapping.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

points

Array<mapCommon.LatLng>

No

No

Collection of road snapping points. The number of the points cannot exceed 100, and the distance between two adjacent points must be less than or equal to 500 meters.

SnapToRoadsResult

Defines the trajectory-based road snapping result.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

responseTime

number

No

No

Time required, in milliseconds.

snappedPoints

Array<SnappedPoint>

No

No

Coordinate points on a road. The number of coordinate points cannot exceed 100, and the distance between two adjacent coordinate points cannot be greater than 500 meters.

SnappedPoint

Defines road snapping points.

Model restriction: This API can be used only in the stage model.

Atomic service API: This API can be used in atomic services since API version 4.1.0(11).

System capability: SystemCapability.Map.Core

Start version: 4.1.0(11)

Parameters:

Name

Type

Read-only

Optional

Description

latitude

number

No

No

Latitude.

longitude

number

No

No

Longitude.

roadId

string

No

No

Road ID.