PROBLEM

Features added via REST operation addFeatures do not retain z-values

Last Published: October 8, 2024

Description

In the ArcGIS REST API, the operation 'addFeatures' can be used to add features to a feature layer:

https://<root>/<serviceName>/FeatureServer/<layerId>/addFeatures

As input, the 'features' parameter of this operation requires an array of features in JSON schema.
The problem might arise that line features defined here do not retain their z values after successfully executing. The features are successfully added to the feature service, but the z values are taken over as 0.

Cause

The geometry specified in the features parameter must be defined according to the Geometry objects ArcGIS REST API documentation.

As described in this specification, some geometry objects (like Multipoint, Polyline and Polygon) require the boolean parameter "hasZ" to interpret the z values correctly. Omitting this property is the equivalent of setting it to false,

Solution or Workaround

Make sure that the parameter "hasZ": true  is included in the geometry definition.

Valid examples can be found in the Geometry objects ArcGIS REST API documentation.

The following is a simple example for a line feature with has enabled z values via the "has Z" parameter:

[
  {
    "attributes": {
      "Attribute1": 123
    },
    "geometry": {
      "hasZ": true,
      "paths": [
        [
          [
            1457918.024,
            6643976.05,
            170.24
          ],
          [
            1458010.65,
            6643833.98,
            172.6
          ],
          [
            1458005.96,
            6643722.02,
            175.61
          ]
        ]
      ]
    }
  }
]

AddFeatures sample value

Article ID: 000033511

Software:
  • ArcGIS REST API

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options