-
tables
Collection<Layer>
autocast
inherited
layer 實例的集合,它們是保存在 Map 和/或 WebMap 中的表。為了使表被識別,FeatureLayer 的 isTable 屬性必須返回
true
。可以通過以下選項之一創建表:- 將 URL 引用到要素服務中的表。
- 使用Layer.fromArcGISServerUrl 方法創建一個要素圖層,並使用要素圖層的isTable 屬性確認它是一個表。這可以是要素服務或要素集合。
- 使用Layer.fromPortalItem 方法創建一個要素圖層,並使用要素圖層的isTable 屬性確認它是一個表。這可以是要素服務或要素集合。
- 創建內存中的非空間客戶端要素圖層。
從 4.17 開始,可以將要素服務中的非空間表持久化到 WebMap,盡管尚不支持內存(要素集合)表。
尚不支持 GroupLayer 中的持久表。如果需要,請將它們添加到 Map 和/或 WebMap 。
目前,僅識別要素服務feature layers。
例子:
// This snippet shows how to add a table to a map's table collection. // FeatureLayer.isTable = false const featureLayer = new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" }); // FeatureLayer.isTable = true const table = new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/1" }); // Add featureLayer to the map map.add(featureLayer); // In order for the table to be stored within // the map's table collection, load it and confirm it is the right type. table.load().then(function() { // Add the table to the collection map.tables.add(table); console.log("Table is added to map's table collection"); });
// This snippet shows how to persist a table to an existing web map // FeatureLayer.isTable = true const table = new FeatureLayer({ url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Crash_details_table/FeatureServer/0" }); // Create Webmap instance const webmap = new WebMap({ portalItem: { id: webmapId } }); // When web map is ready, load the table and add it to the web map webmap.when(function() { table.load().then(function() { console.log("Adding table"); // Add table to the webmap's table collection webmap.tables.add(table); }); }); // Call updateFrom on webmap and pass in the existing view webmap.updateFrom(view).then(function() { // Call saveAs (or save) on the web map webmap.saveAs({ // autocasts as new PortalItem() title: "New WebMap" }); });
// This snippet shows how to add an in-memory table to a map // Create the array of objects containing field info const fields = [{ name: "ObjectID", alias: "ObjectID", type: "oid" }, { name: "tree_type", alias: "Tree type", type: "string" }, { name: "species", alias: "Species", type: "string" }]; // Create the array of graphics holding attribute info const graphics = [{ attributes: { "tree_type": "deciduous", "species": "maple", "ObjectID": 2 } }, { attributes: { "tree_type": "coniferous", "species": "pine", "ObjectID": 3 } }]; // Create the feature layer (feature collection) table const table = new FeatureLayer({ fields: fields, objectIdField: "ObjectID", source: graphics }); // Check when map is ready and load the table map.when(function() { table.load().then(function() { console.log("Adding table"); map.tables.add(table); }); });
基本信息
以下是所在類或對象的基本信息。
AMD:
require(["esri/WebScene"], (WebScene) => { /* code goes here */ });
ESM:
import WebScene from "@arcgis/core/WebScene";
類:
esri/WebScene
自從:用於 JavaScript 4.0 的 ArcGIS API
用法說明
WebScene.tables
函數(或屬性)的定義如下:
相關用法
- JavaScript ArcGIS WebScene.thumbnailUrl用法及代碼示例
- JavaScript ArcGIS WebScene.loadAll用法及代碼示例
- JavaScript ArcGIS WebScene.ground用法及代碼示例
- JavaScript ArcGIS WebScene.layers用法及代碼示例
- JavaScript ArcGIS WebScene.load用法及代碼示例
- JavaScript ArcGIS WebScene.saveAs用法及代碼示例
- JavaScript ArcGIS WebScene.destroy用法及代碼示例
- JavaScript ArcGIS WebScene.addMany用法及代碼示例
- JavaScript ArcGIS WebScene.fromJSON用法及代碼示例
- JavaScript ArcGIS WebScene.basemap用法及代碼示例
- JavaScript ArcGIS WebScene.save用法及代碼示例
- JavaScript ArcGIS WebScene.when用法及代碼示例
- JavaScript ArcGIS WebScene.allTables用法及代碼示例
- JavaScript ArcGIS WebScene.add用法及代碼示例
- JavaScript ArcGIS WebScene.allLayers用法及代碼示例
- JavaScript ArcGIS WebScene用法及代碼示例
- JavaScript ArcGIS WebStyleSymbol.fetchSymbol用法及代碼示例
- JavaScript ArcGIS WebStyleSymbol用法及代碼示例
- JavaScript ArcGIS WebStyleSymbol.fetchCIMSymbol用法及代碼示例
- JavaScript ArcGIS WebStyleSymbol.clone用法及代碼示例
- JavaScript ArcGIS WebTileLayer layerview-create-error事件用法及代碼示例
- JavaScript ArcGIS WebTileLayer.maxScale用法及代碼示例
- JavaScript ArcGIS WebMap.saveAs用法及代碼示例
- JavaScript ArcGIS WebMap.save用法及代碼示例
- JavaScript ArcGIS WebMap.destroy用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 WebScene.tables。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。