-
helperServices
Object
- 自从:ArcGIS 适用于 JavaScript 4.4 的 API
门户提供的帮助服务。这对于确定相关方法的 URL 很有用。建议将这些 URL 与它们各自的
rest
模块一起使用,而不是不推荐使用的辅助方法。有关帮助服务的其他信息,请参阅 ArcGIS 服务器文档中的 about utility services 主题。
例子:
require([ "esri/Map", "esri/views/MapView", "esri/portal/Portal", "esri/core/Collection", "esri/layers/GraphicsLayer", "esri/rest/route", "esri/rest/support/RouteParameters", "esri/rest/support/Stop", ... ], function(Map, MapView, Portal, Collection, GraphicsLayer, route, RouteParameters, Stop, ... ) { // create new Portal object with relevant URL const portal = new Portal({ url: "YOUR_PORTAL_URL" }); // the stops and route result will be stored in this layer const routingLayer = new GraphicsLayer(); const map = new Map({ basemap: "streets-navigation-vector", layers: [routingLayer] }); const view = new MapView({ container: "viewDiv", map: map, center: [-117.39966, 34.06873], zoom: 10 }); // 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 }); // define the symbology used to display the route const routeSymbol = { type: "simple-line", // autocasts as SimpleLineSymbol() color: [175, 155, 215, 0.5], width: 5 }; // load Portal instance portal.load().then(function() { // display URLs to all helper services console.log("Show helperServices URLs: ", portal.helperServices); // access helperServices from the Portal instance // to get the routing URL of interest const routeURL = portal.helperServices.route.url; // use helperServices to perform routing route.solve(routeURL, routeParams).then(showRouteInfo); } // do something useful with the results // like display them to the console // or display them on the map function showRouteInfo(routeSolveResult) { console.log("Show all results: ", routeSolveResult); const routeResult = routeSolveResult.routeResults[0].route; routeResult.symbol = routeSymbol; routingLayer.add(routeResult); } });
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/portal/Portal"], (Portal) => { /* code goes here */ });
ESM:
import Portal from "@arcgis/core/portal/Portal";
类:
esri/portal/Portal
继承: Portal > Accessor
自从:用于 JavaScript 4.0 的 ArcGIS API
用法说明
Portal.helperServices
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS Portal.fetchBasemaps用法及代码示例
- JavaScript ArcGIS Portal.queryItems用法及代码示例
- JavaScript ArcGIS Portal.createPrintTask用法及代码示例
- JavaScript ArcGIS Portal.when用法及代码示例
- JavaScript ArcGIS Portal.fetchCategorySchema用法及代码示例
- JavaScript ArcGIS Portal.createRouteTask用法及代码示例
- JavaScript ArcGIS Portal.fetchFeaturedGroups用法及代码示例
- JavaScript ArcGIS Portal.queryUsers用法及代码示例
- JavaScript ArcGIS Portal.createServiceAreaTask用法及代码示例
- JavaScript ArcGIS PortalItem.id用法及代码示例
- JavaScript ArcGIS PortalItem.isLayer用法及代码示例
- JavaScript ArcGIS PortalItem.addResource用法及代码示例
- JavaScript ArcGIS PortalItem.destroy用法及代码示例
- JavaScript ArcGIS PortalItem.portal用法及代码示例
- JavaScript ArcGIS PortalUser.fetchItems用法及代码示例
- JavaScript ArcGIS PortalItem.fetchRelatedItems用法及代码示例
- JavaScript ArcGIS Portal用法及代码示例
- JavaScript ArcGIS PortalQueryParams.categories用法及代码示例
- JavaScript ArcGIS PortalGroup.fetchMembers用法及代码示例
- JavaScript ArcGIS PortalUser.fetchGroups用法及代码示例
- JavaScript ArcGIS PortalItem.when用法及代码示例
- JavaScript ArcGIS PortalItem.type用法及代码示例
- JavaScript ArcGIS PortalUser.fetchFolders用法及代码示例
- JavaScript ArcGIS PortalGroup.fetchCategorySchema用法及代码示例
- JavaScript ArcGIS PortalItem.fetchResources用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 Portal.helperServices。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。