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


JavaScript ArcGIS Feature用法及代碼示例

基本信息

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

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

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

類: esri/widgets/Feature

繼承: Feature > Widget > Accessor

自從:用於 JavaScript 4.7 的 ArcGIS API

用法說明

Feature 小部件根據其 PopupTemplate 顯示圖形。此小部件在您想要顯示有關函數的信息但不使用 Popup 的情況下很有用。

當彈出模板將 Arcade 表達式定義為任何彈出模板內容中引用的計算值或表達式元素時,必須在要執行的 Arcade 的要素小部件中定義Map和 SpatialReference 屬性。

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

例子:

// Create graphic
let graphic = new Graphic({
  geometry: view.center,
  popupTemplate: {
    content: [{
      // add popupTemplate content
    }]
  }
});

// map and spatialReference must be set for Arcade
// expressions to execute and display content
let feature = new Feature({
  graphic: graphic,
  map: map,
  spatialReference: spatialReference
});

view.ui.add(feature, "top-right");

相關用法


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