-
travelMode
TravelMode
出行方式代表一种交通工具,例如驾车或步行。出行模式定义了车辆或行人的物理特征。
travelMode
参数的值是 JSON 对象,其中包含您的服务支持的出行模式的设置。要获得支持的出行模式,请执行retrieveTravelModes
操作。您可以使用以下表单请求检索出行模式:https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/retrieveTravelModes?f=json
例子:
// Display the fastest walking time route between two existing graphics. const apiKey = "<your-api-key>"; const url = "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"; // Obtain the routing service's description. The description contains all preset travel modes. const serviceDescription = await networkService.fetchServiceDescription(url, apiKey); // Find the named travel mode called "Walking Time". const { supportedTravelModes } = serviceDescription; const travelMode = supportedTravelModes.find((mode) => mode.name === "Walking Time"); // Construct the route parameter object. const routeParameters = new RouteParameters({ apiKey, stops: new FeatureSet({ features: view.graphics.toArray() }), returnDirections: true, travelMode }); // Solve the route and add the path representing the fastest walk path to the map. const routeContainer = await route.solve(url, routeParameters); for (const routeResult of routeContainer.routeResults) { const { routeLayer } = routeResult; routeLayer.symbol = { type: "simple-line", color: [5, 150, 255], width: 3 }; view.graphics.add(routeLayer); }
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/rest/support/RouteParameters"], (RouteParameters) => { /* code goes here */ });
ESM:
import RouteParameters from "@arcgis/core/rest/support/RouteParameters";
类:
esri/rest/support/RouteParameters
继承: RouteParameters > Accessor
自从:用于 JavaScript 4.20 的 ArcGIS API
用法说明
RouteParameters.travelMode
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS RouteParameters.findBestSequence用法及代码示例
- JavaScript ArcGIS RouteParameters.apiKey用法及代码示例
- JavaScript ArcGIS RouteLayer.solve用法及代码示例
- JavaScript ArcGIS RouteLayer layerview-create事件用法及代码示例
- JavaScript ArcGIS RouteLayer.stops用法及代码示例
- JavaScript ArcGIS RouteLayer.opacity用法及代码示例
- JavaScript ArcGIS RouteLayer.visible用法及代码示例
- JavaScript ArcGIS RouteLayer.saveAs用法及代码示例
- JavaScript ArcGIS RouteLayer.portalItem用法及代码示例
- JavaScript ArcGIS RouteLayer.effect用法及代码示例
- JavaScript ArcGIS RouteLayer.url用法及代码示例
- JavaScript ArcGIS RouteLayer layerview-create-error事件用法及代码示例
- JavaScript ArcGIS RouteLayer.minScale用法及代码示例
- JavaScript ArcGIS RouteLayer.maxScale用法及代码示例
- JavaScript ArcGIS RouteInfo用法及代码示例
- JavaScript ArcGIS RouteLayer.when用法及代码示例
- JavaScript ArcGIS RouteLayer.on用法及代码示例
- JavaScript ArcGIS RouteLayer.fullExtent用法及代码示例
- JavaScript ArcGIS RouteLayer.save用法及代码示例
- JavaScript ArcGIS RouteLayer用法及代码示例
- JavaScript ArcGIS RotationVariable用法及代码示例
- JavaScript ArcGIS RotationVariable.clone用法及代码示例
- JavaScript ArcGIS RasterShadedReliefRenderer.clone用法及代码示例
- JavaScript ArcGIS RelationshipQuery.orderByFields用法及代码示例
- JavaScript ArcGIS RasterColormapRenderer.createFromColormap用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 RouteParameters.travelMode。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。