[英]Can I use ArcGIS REST-API "applyEdits" to update Feature-Layer as an authenticated user?
我正在使用 nodeJS 使用 REST API 編輯我的功能層。 我的意圖是:
我的問題:如果我編輯我的功能定義,以"capabilities" : "Create, Update, Delete"
提到這里,那么任何未經授權的用戶可以編輯我的層,而如果我不這樣做,我得到:
[ '不支持此操作。', '無法添加功能。', '不支持此操作。' ]
身份驗證在文檔中聲明。
我的代碼:
require("cross-fetch/polyfill");
require("isomorphic-form-data");
const featureLayer = require('@esri/arcgis-rest-feature-layer');
const auth = require('@esri/arcgis-rest-auth');
const apiKey = new auth.ApiKey({key: 'some key...'});
featureLayer.applyEdits({
url: "https://services3.arcgis.com/someID/arcgis/rest/services/someName/FeatureServer/0",
adds: [{
geometry: { x: 120, y: 45 },
attributes: { indexCity: "alive" }
}],
authentication: apiKey
})
.then(response => {
console.log(response)
})
.catch(err => console.log(err.response.error.details));
我在終端中使用node example.js
運行我的代碼。
一種選擇是對私有要素圖層(可編輯)進行編輯,然后擁有該要素圖層的公共(不可編輯)視圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.