Skip to main content
Solved

JSONUpdater: Delete

  • September 20, 2019
  • 1 reply
  • 48 views

nielsgerrits
VIP
Forum|alt.badge.img+55

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:

Best answer by nielsgerrits

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.

View original
Did this help you find an answer to your question?

1 reply

nielsgerrits
VIP
Forum|alt.badge.img+55
  • Author
  • Best Answer
  • September 20, 2019

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings