基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/rest/support/RouteInfo"], (RouteInfo) => { /* code goes here */ });
ESM:
import RouteInfo from "@arcgis/core/rest/support/RouteInfo";
类:
esri/rest/support/RouteInfo
继承: RouteInfo > Accessor
自从:用于 JavaScript 4.23 的 ArcGIS API
用法说明
RouteInfo 包含有关已解决路线的信息,包括路线几何形状以及总距离和时间。
例子:
// Display the route name and overall distance and duration.
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
});
const formatDate = new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
timeZone: "America/Los_Angeles"
});
const { name, startTime, endTime, totalDistance, totalDuration } = routeLayer.routeInfo;
console.log(`Route name: ${name}`);
console.log(`Start Time: ${formatDate.format(startTime)}`);
console.log(`End Time: ${formatDate.format(endTime)}`);
console.log(`Travel Time: ${formatMinutes.format(totalDuration)} minutes`);
console.log(`Travel Distance: ${formatDistance.format(totalDistance)} meters`);
// Route name: Kenoak Pl, Pomona, California, 91768 — 16561 Valley Blvd, Fontana, California, 92335
// Start Time: 12/7/2020, 3:58:50 PM
// End Time: 12/7/2020, 6:12:20 PM
// Travel Time: 133.5 minutes
// Travel Distance: 173,148 meters
相关用法
- JavaScript ArcGIS RouteParameters.findBestSequence用法及代码示例
- JavaScript ArcGIS RouteLayer.solve用法及代码示例
- JavaScript ArcGIS RouteLayer layerview-create事件用法及代码示例
- JavaScript ArcGIS RouteLayer.stops用法及代码示例
- JavaScript ArcGIS RouteParameters.travelMode用法及代码示例
- JavaScript ArcGIS RouteLayer.opacity用法及代码示例
- JavaScript ArcGIS RouteLayer.visible用法及代码示例
- JavaScript ArcGIS RouteLayer.saveAs用法及代码示例
- JavaScript ArcGIS RouteLayer.portalItem用法及代码示例
- JavaScript ArcGIS RouteLayer.effect用法及代码示例
- JavaScript ArcGIS RouteParameters.apiKey用法及代码示例
- JavaScript ArcGIS RouteLayer.url用法及代码示例
- JavaScript ArcGIS RouteLayer layerview-create-error事件用法及代码示例
- JavaScript ArcGIS RouteLayer.minScale用法及代码示例
- JavaScript ArcGIS RouteLayer.maxScale用法及代码示例
- 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大神的英文原创作品 RouteInfo。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。