-
solve
(url, params, requestOptions)
{Promise<RouteSolveResult>}
使用路由参数求解针对路由层的路由。
参数:
类型 说明 url String表示网络分析服务的 ArcGIS 服务器 REST 资源的 URL。
params RouteParameters用作生成路由的输入的路由参数。
requestOptions Object可选的 用于数据请求的附加options(将覆盖构造期间定义的 requestOptions)。
返回:
类型 说明 Promise<RouteSolveResult> 解析后,返回 RouteSolveResult 的实例。 例子:
require([ "esri/rest/route", "esri/core/Collection", "esri/rest/support/RouteParameters", "esri/rest/support/Stop", ... ], function(route, Collection, RouteParameters, Stop, ... ) { // point the URL to a valid routing service const routeUrl = "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"; // create a Collection of new Stops const stops = new Collection([ new Stop({ geometry: { x: -117.59275, y: 34.06200 }, name: "Ontario Airport" }), new Stop({ geometry: { x: -117.19570, y: 34.05609 }, name: "Esri Campus" }) ]); // setup the RouteParameters with API key and Stops const routeParams = new RouteParameters({ // An authorization string used to access the routing service apiKey: "YOUR_API_KEY", stops }); // solve the route with the RouteParameters function solveRoute() { route.solve(routeUrl, routeParams).then(showRouteInfo); } // do something useful with the results // like display them to the console function showRouteInfo(routeSolveResult) { console.log("Show all results: ", routeSolveResult); console.log("Show the route information: ", routeSolveResult.routeResults[0].route); } solveRoute(); });
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/rest/route"], (route) => { /* code goes here */ });
ESM:
import * as route from "@arcgis/core/rest/route";
对象:
esri/rest/route
自从:用于 JavaScript 4.19 的 ArcGIS API
用法说明
route.solve
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS relationship.cloneScheme用法及代码示例
- JavaScript ArcGIS relationship.getSchemeByName用法及代码示例
- JavaScript ArcGIS relationship.getSchemesByTag用法及代码示例
- JavaScript ArcGIS relationship.getSchemes用法及代码示例
- JavaScript ArcGIS request.RequestResponse用法及代码示例
- JavaScript ArcGIS request.RequestOptions用法及代码示例
- JavaScript ArcGIS request用法及代码示例
- JavaScript ArcGIS request.getHeader用法及代码示例
- JavaScript ArcGIS relationship.createRenderer用法及代码示例
- JavaScript ArcGIS SceneView double-click事件用法及代码示例
- JavaScript ArcGIS geometryEngineAsync.overlaps用法及代码示例
- JavaScript ArcGIS Expand.when用法及代码示例
- JavaScript ArcGIS Sublayer.JoinTableDataSource用法及代码示例
- JavaScript ArcGIS FillSymbol3DLayer.outline用法及代码示例
- JavaScript ArcGIS Ground.loadAll用法及代码示例
- JavaScript Object valueOf()用法及代码示例
- JavaScript ArcGIS LabelClass.repeatLabelDistance用法及代码示例
- JavaScript ArcGIS KMLLayerView.when用法及代码示例
- JavaScript ArcGIS Daylight.visibleElements用法及代码示例
- JavaScript Uint8Array.of()用法及代码示例
- JavaScript ArcGIS CIMSymbol.CIMTextSymbol用法及代码示例
- JavaScript new Legend用法及代码示例
- JavaScript Slider.effectiveMin用法及代码示例
- JavaScript Sketch.classes用法及代码示例
- JavaScript Sketch.visible用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 route.solve。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。