import { LngLatLike } from 'maplibre-gl'; import { TravelMode, GeometryType, AvoidType, OverviewType, ApproachType } from '@src/common/interface'; import { NBRequestStatus, StepIntersections, StepManeuver } from './common'; export interface NavigationBearingInfo { degree: number; range: number; } /** * A navigation query to be sent to the NavigationSerivce */ export type NavigationRequest = { /** * Origin is the starting point of your route. Ensure that origin is a valid land location. * * [This parameter is mandatory IF geometry parameter is not given] */ origin?: LngLatLike; /** * Destination is the ending coordinates of your route. Ensure that destination is a valid land location. * * [This parameter is mandatory IF geometry parameter is not given] * */ destination?: LngLatLike; /** * Waypoints are coordinates along the route between Origin and Destination. This is a pipe separated list of coordinate pairs. * * Default maximum limit is 200 * */ waypoints?: LngLatLike[]; /** 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. */ mode?: TravelMode | string; /** * language of the text instruction */ lang?: string; /** * If this parameter is provided, the only other parameters which will be considered in the request are `geometry_type`, `lang` and `key`. The rest of the parameters will be ignored. */ geometry?: string; /** This parameter sets the departure time in Unix epoch time seconds format. Unit: seconds. PS: This parameter is only supported in premium plan. */ departureTime?: number; /** Unique session ID. If set, the response will reuse cached trip characteristics. PS: This parameter is only supported in premium plan. */ session?: string; /** Sets the output format of the route geometry in the response. Default: `polyline6`. */ geometryType?: GeometryType; /** * If enabled, the API will return alternative routes. * * You can set the number of routes in the `altCount` property. Note: `altcount` will default to `3` if this is enabled. */ alternatives?: boolean; /** Sets the number of alternative routes to return. Default: `3`. */ altCount?: number; /** Setting this will ensure the route avoids ferry, tolls or highways. */ avoid?: AvoidType[]; /** Output verbosity of overview (whole trip) geometry. Default: `full`. */ overview?: OverviewType; /** * Limits the search to segments with given bearing in degrees towards true north in clockwise direction. * * Note: Number of bearings should be equal to the number of coordinates. */ bearings?: NavigationBearingInfo[]; /** A 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. */ approaches?: ApproachType[]; /** * api key for the request */ apiKey?: string; }; /** * The navigation response retrieved from the navigation server. */ export type NavigationResult = { country_code?: string; /** A string indicating the state of the response. This is a separate code than the HTTP status code. On normal valid responses, the value will be Ok. */ status: NBRequestStatus | string; /** error message if status is not 200. */ error_msg?: string; /** routes calculated. */ routes?: Array; }; /** * @interface NavigationResponseRoute * The route information returned by the navigation service. */ export interface NavigationResponseRoute { /** * route driving distance. * * Unit: `meters` */ distance: number; distance_full?: number; /** * route driving duration. * * Unit: `seconds` */ duration: number; geojson?: { coordinates: number[][]; }; /** encoded geometry value for step in `polyline` or `polyline6`. */ geometry?: string; /** * start location of route */ start_location?: { latitude: number; longitude: number; }; /** * end location of route */ end_location?: { latitude: number; longitude: number; }; /** * legs of route. * * Note: `waypoints` split `route` into `legs` */ legs: Array; /** * special geospatial objects crossed along the trip. */ special_objects?: any; } /** * @interface NavigationResponseLeg * The leg information in the route. */ export interface NavigationResponseLeg { /** * leg driving distance. * * Unit: `meters` */ distance: { value: number; }; /** * leg driving duration. * * Unit: `seconds` */ duration: { value: number; }; start_location?: { latitude: number; longitude: number; }; end_location?: { latitude: number; longitude: number; }; steps: Array; } /** * @interface NavigationResponseLegStep * The step information in the leg. */ export interface NavigationResponseLegStep { name?: string; reference?: string; geometry?: string; /** * leg driving distance. * * Unit: `meters` */ distance: { value: number; }; /** * leg driving duration. * * Unit: `seconds` */ duration: { value: number; }; geojson?: { coordinates: Array>; }; intersections?: Array; maneuver?: StepManeuver; start_location: { latitude: number; longitude: number; }; end_location: { latitude: number; longitude: number; }; } /** * A service for calculating navigation between locations. * Can be accessed by `nextbillion.maps.NavigationService` if you load SDK by CDN url. */ export declare class NavigationService { /** * Request navigation between an origin and a destination. * @param opt request options * @returns navigation result of the request */ route(opt: NavigationRequest): Promise; } //# sourceMappingURL=navigation.d.ts.map