當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS ElevationProfile用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/widgets/ElevationProfile"], (ElevationProfile) => { /* code goes here */ });

ESM: import ElevationProfile from "@arcgis/core/widgets/ElevationProfile";

類: esri/widgets/ElevationProfile

繼承: ElevationProfile > Widget > Accessor

自從:用於 JavaScript 4.18 的 ArcGIS API

用法說明

ElevationProfile 小部件用於從輸入線圖形生成和顯示高程剖麵。可以通過繪製單條線或multi-segment線,或通過在視圖中選擇線要素來交互式設置輸入圖形。或者,小部件允許在創建時或在運行時通過設置輸入屬性以編程方式設置輸入圖形。

elevation-profile ElevationProfile 小部件用於城市場景,顯示地麵和建築物輪廓。見Sample - ElevationProfile widget

該小部件可以可視化多個剖麵線,具體取決於環境(2D 與 3D)和高程源數據:

  • ElevationProfileLineGround 可以在 MapViewSceneView 中使用。在這種情況下,高程直接從 Map.ground 采樣。無論您的Map是 2D 還是 3D 顯示,都需要在Map上設置地麵屬性。

  • ElevationProfileLineInput 從輸入圖形的幾何圖形中采樣高程數據。它通常與具有 z 值的輸入行數據一起使用。如果輸入的行數據沒有 z 值,如果該線以非疊加高程模式顯示,則還會計算輪廓線。也可以應用高程偏移。目前在 2D 中,z 值不是從基於特征的圖層中獲取的,因此在 MapView 中,此輪廓線隻能與具有 z 值的客戶端圖形一起使用。

  • ElevationProfileLineQuerysource 屬性中設置的高程源中采樣高程數據。高程源可以是 ElevationLayer 或具有稱為 queryElevation 的方法的任何對象,具有與 queryElevation 相同的簽名。

  • ElevationProfileLineView 僅在 SceneView 中可用,它顯示沿輸入圖形直接從視圖采樣的高程。 SceneView 中的所有體積對象都有助於生成的配置文件。

您可以通過在配置文件屬性中進行設置,選擇在圖表中顯示一條或多條配置線。

將所有輪廓細化到其最大分辨率後,相應的 3D 輪廓線將出現在 SceneView 中(當前在 MapView 中不顯示任何線條),並且 profile statistics 將顯示在每個輪廓線的圖例中。懸停在圖表上會顯示一個疊加的工具提示,其中包含所有剖麵的高程值,並在 3D 視圖中的匹配位置上顯示彩色點標記。

圖例中的複選框允許隱藏單個配置文件。圖表單位可以通過設置菜單設置為公製、英製或特定單位。圖表上的Click-and-drag 放大到剖麵圖的特定部分。放大時,單擊減號按鈕重置縮放。

elevation-profile-draw 繪製路徑以獲得地麵輪廓。

elevation-profile-zline 從帶有z-values 的線要素生成的剖麵圖顯示了地麵上方的滑翔傘軌跡。

已知限製

有關獲得對小部件樣式的完全控製的信息,請參閱Styling 主題。

例子:

const elevationProfile = new ElevationProfile({
  view: view
});
// adds the ElevationProfile to the top right corner of the view
view.ui.add(elevationProfile, "top-right");
// elevation profile with all the line profiles
const elevationProfile = new ElevationProfile({
  view: view,
  profiles: [{
    // displays elevation values from Map.ground
    type: "ground", //autocasts as new ElevationProfileLineGround()
    color: "#61d4a4",
    title: "Ground elevation"
  }, {
    // displays elevation values from the input line graphic
    type: "input", //autocasts as new ElevationProfileLineInput()
    color: "#f57e42",
    title: "Line elevation"
  }, {
    // displays elevation values from a SceneView
    type: "view", //autocasts as new ElevationProfileLineView()
    color: "#8f61d4",
    title: "View elevation"
    // by default ground and all layers are used to compute elevation, but
    // you can define which elements should be included/excluded from the computation
    exclude: [map.ground]
  }, {
    // displays elevation values from a custom source
    type: "query",
    source: new ElevationLayer({
      url: "https://elevation3d.arcgis.com/arcgis/rest/../Terrain3D/ImageServer"
    }),
    color: "#d46189",
    title: "Custom elevation"
  }]
});
view.ui.add(elevationProfile, "bottom-right");

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 ElevationProfile。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。