Solved

JSONUpdater: Delete

  • 20 September 2019
  • 1 reply
  • 6 views

Userlevel 6
Badge +32

Background: I try to update the attributes of features in an ArcGIS Server Feature Service via the REST endpoint. (ApplyEdits) In an attempt to create a generic solution, I write my features to an Esri-JSON, then read the result back in as a text file and use the JSONUpdater and the JSONTemplater to create the JSON ArcGIS Server understands. My goal is to produce the following JSON:

[{
    "id": 0,
    "updates": [{
        "attributes": {
            "objectid": 1,
            "attribute1": "a"
        }
    }, {
        "attributes": {
            "objectid": 2,
            "attribute1": "b"
        }
    }]
}]

My Esri-JSON is:

{
    "RecordSet" : {
        "geometryType" : "esriGeometryPoint",
        "spatialReference" : {
            "wkid" : ""
        },
        "features" : [
            {
                "geometry" : {
                    "x" : 0,
                    "y" : 0
                },
                "attributes" : {
                    "objectid" : 1,
                    "attribute1" : "a"
                }
            },
            {
                "geometry" : {
                    "x" : 0,
                    "y" : 0
                },
                "attributes" : {
                    "objectid" : 2,
                    "attribute1" : "b"
                }
            }
        ]
    }
}

Now I want to delete "geometry" as I only want to update the attributes. (I think to understand geometry is an Object, correct?) I think the correct path to geometry is:

json["RecordSet"]["features"][*]["geometry"]

But I do not understand how I get the syntax right to let the JSONUpdater delete it...

Can anyone point me in the right direction?

Added workspace:

icon

Best answer by nielsgerrits 20 September 2019, 10:48

View original

1 reply

Userlevel 6
Badge +32

Turned out I did change the object "features" to "updates", but did not change the path as well...

The correct syntax is:

  • Update Type
    • Delete From Object
  • JSON Path
    • json["RecordSet"]["updates"][*]
  • Object/Array Index
    • geometry

Happy I at least understood how it should work.

Reply