基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/rest/support/DirectionLine"], (DirectionLine) => { /* code goes here */ });
ESM:
import DirectionLine from "@arcgis/core/rest/support/DirectionLine";
类:
esri/rest/support/DirectionLine
继承: DirectionLine > Accessor
自从:用于 JavaScript 4.23 的 ArcGIS API
用法说明
DirectionLine 表示与各个方向项关联的折线。
例子:
// Print the distance and time between each direction.
const routeLayer = new RouteLayer({
portalItem: {
id: "69569b47b1e445b8a42ec12feab41ce9"
}
});
await routeLayer.load();
const locale = "en-US";
const formatMinutes = new Intl.NumberFormat(locale, {
minimumFractionDigits: 1,
maximumFractionDigits: 1
});
const formatDistance = new Intl.NumberFormat(locale, {
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
for (const directionLine of routeLayer.directionLines) {
const { distance, duration } = directionLine;
console.log(`Drive ${formatDistance.format(distance)} meters for ${formatMinutes.format(duration)} minutes.`);
}
// Drive 76 meters for 0.4 minutes.
// Drive 77 meters for 0.2 minutes.
// Drive 150 meters for 0.2 minutes.
// Drive 3,670 meters for 2.6 minutes.
// Drive 307 meters for 0.2 minutes.
// Drive 6,293 meters for 4.5 minutes.
// Drive 42,276 meters for 29.2 minutes.
// etc.
相关用法
- JavaScript ArcGIS Directions.visible用法及代码示例
- JavaScript ArcGIS Directions.routeServiceUrl用法及代码示例
- JavaScript ArcGIS DirectionPoint用法及代码示例
- JavaScript ArcGIS Directions.when用法及代码示例
- JavaScript ArcGIS Directions.apiKey用法及代码示例
- JavaScript ArcGIS Directions.container用法及代码示例
- JavaScript ArcGIS Directions.headingLevel用法及代码示例
- JavaScript ArcGIS Directions.goToOverride用法及代码示例
- JavaScript ArcGIS Directions.classes用法及代码示例
- JavaScript ArcGIS Directions.on用法及代码示例
- JavaScript ArcGIS Directions用法及代码示例
- JavaScript ArcGIS DirectLineMeasurementAnalysisView3D用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D.when用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D.on用法及代码示例
- JavaScript ArcGIS DirectLineMeasurementAnalysis用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D.classes用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D.analysis用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D.container用法及代码示例
- JavaScript ArcGIS DirectLineMeasurement3D用法及代码示例
- JavaScript ArcGIS DistanceMeasurement2D.unitOptions用法及代码示例
- JavaScript ArcGIS DistanceMeasurement2D.unit用法及代码示例
- JavaScript ArcGIS DimensionalDefinition用法及代码示例
- JavaScript ArcGIS DistanceMeasurement2D.view用法及代码示例
- JavaScript ArcGIS DistanceMeasurement2D用法及代码示例
- JavaScript ArcGIS DictionaryRenderer.visualVariables用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 DirectionLine。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。