簡體   English   中英

作為經過身份驗證的用戶,我可以使用 ArcGIS REST-API“applyEdits”來更新要素圖層嗎?

[英]Can I use ArcGIS REST-API "applyEdits" to update Feature-Layer as an authenticated user?

我正在使用 nodeJS 使用 REST API 編輯我的功能層。 我的意圖是:

  1. 使用 Firebase Cloud-Functions 更新我的層
  2. 公開共享我的圖層
  3. 但讓未經授權的用戶無法編輯我的圖層
  4. 我想使用我的 API-Key 進行身份驗證。

我的問題:如果我編輯我的功能定義,以"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運行我的代碼。

作為經過身份驗證的用戶,我如何僅為我定義 appleEdits?

一種選擇是對私有要素圖層(可編輯)進行編輯,然后擁有該要素圖層的公共(不可編輯)視圖。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM