import type Extent from "../../geometry/Extent.js"; import type Polyline from "../../geometry/Polyline.js"; import type DirectionsFeature from "./DirectionsFeature.js"; import type DirectionsString from "./DirectionsString.js"; import type FeatureSet from "./FeatureSet.js"; import type { FeatureSetProperties } from "./FeatureSet.js"; import type { ExtentProperties } from "../../geometry/Extent.js"; export interface DirectionsFeatureSetProperties extends FeatureSetProperties, Partial> { /** The extent of the route. */ extent?: ExtentProperties; /** An array of direction features. The features are of type [DirectionsFeature](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DirectionsFeature/). */ features?: DirectionsFeature[]; /** * The geometry type of the Directions FeatureSet. * * @default "polyline" */ geometryType?: "polyline"; } /** * DirectionsFeatureSet is a subclass of [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) that contains street directions * for a [solved route](https://developers.arcgis.com/javascript/latest/references/core/rest/route/#solve). * * DirectionsFeatureSet is only returned when a route is solved with an * [directions output type](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsOutputType) of * `"complete"`, `"complete-no-events"`, `"instructions-only"`, `"standard"`, or `"summary-only"`. The "featuresets" output type * returns two regular [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/), one for events, and the other for the path in-between events. * * @since 4.20 * @see [route](https://developers.arcgis.com/javascript/latest/references/core/rest/route/) * @see [RouteResult.directions](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteResult/#directions) * @example * // Get the drive time between Esri and the Redlands Bowl * const apiKey = ""; * const url = "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"; * * const spatialReference = SpatialReference.WebMercator; * * const stops = new Collection([ * new Stop({ * name: "Esri", * geometry: new Point({ x: -13046165, y: 4036335, spatialReference }) * }), * new Stop({ * name: "Redland Bowl", * geometry: new Point({ x: -13045111, y: 4036114, spatialReference }) * }) * ]); * * const routeParameters = new RouteParameters({ * apiKey, * stops, * outSpatialReference: spatialReference, * returnDirections: true, * directionsOutputType: "standard" // default value * }); * * const { routeResults } = await route.solve(url, routeParameters); * const { directions } = routeResults[0]; * console.log(`The total drive time is: ${directions.totalTime}`); */ export default class DirectionsFeatureSet extends FeatureSet { constructor(properties?: DirectionsFeatureSetProperties); /** The extent of the route. */ get extent(): Extent; set extent(value: ExtentProperties); /** An array of direction features. The features are of type [DirectionsFeature](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DirectionsFeature/). */ accessor features: DirectionsFeature[]; /** * The geometry type of the Directions FeatureSet. * * @default "polyline" */ accessor geometryType: "polyline"; /** A single polyline representing the route. */ get mergedGeometry(): Polyline | null; /** The ID of the route. */ accessor routeId: number | null | undefined; /** The name of the route. */ accessor routeName: string | null | undefined; /** A flattened array of all [direction strings](https://developers.arcgis.com/javascript/latest/references/core/rest/support/DirectionsString/). */ get strings(): DirectionsString[]; /** * The total drive time for the route. * Temporal units are defined by [RouteParameters.directionsTimeAttribute](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsTimeAttribute) * in a [route solve](https://developers.arcgis.com/javascript/latest/references/core/rest/route/#solve) request. */ accessor totalDriveTime: number | null | undefined; /** * The total length of the route. * Length units are defined by [RouteParameters.directionsLengthUnits](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsLengthUnits) * in a [route solve](https://developers.arcgis.com/javascript/latest/references/core/rest/route/#solve) request. * * @see [RouteParameters.directionsLengthUnits](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsLengthUnits) */ accessor totalLength: number | null | undefined; /** * The total time for the route including wait and service time. * Temporal units are defined by [RouteParameters.directionsTimeAttribute](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsTimeAttribute) * in a [route solve](https://developers.arcgis.com/javascript/latest/references/core/rest/route/#solve) request. * * @see [RouteParameters.directionsTimeAttribute](https://developers.arcgis.com/javascript/latest/references/core/rest/support/RouteParameters/#directionsTimeAttribute) */ accessor totalTime: number | null | undefined; }