-
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。