Select to view content in your preferred language

Does AddFeatures endpoint accept WKT format in the geometry of each feature?

521
0
04-19-2022 04:23 AM
dbarriop2000
New Contributor

Hi everyone,

Did anyone try to add features using the /rest/services/.../{layerid}/addFeatures endpoint and using WKT json input for the geometry?

I find the documentation quite ambiguous when it shows:

  • For the Features parameter: "The structure of each feature in the array is the same as the structure of the json feature object returned by the ArcGIS REST API."
  • For the Geometry in json feature object: geometry—The feature geometry. It can be any of the supported geometry types. It is a JSON object as defined in the Geometry Objects documentation.
  • Geometry Objects documentation: Appears the json WKT-based syntax as a valid syntax to represent geometries.

I tried in the add features web form the following input:

 

 

 

 

[{
    "wkt": "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",POINT[\"WGS_1984\",-79.419591,43.647131]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]",
    "attributes": {
      "ProductId": 10175
    }
}]

 

As you can see in the attached image, the endpoint ended with success adding a new item with objectid 3636.

But this is the result of the features query after the "creation". It seems to create an empty/invalid geometry storing only the attributes but no geometry information.:

{
 "objectIdFieldName": "OBJECTID",
 "globalIdFieldName": "",
 "geometryType": "esriGeometryPoint",
 "spatialReference": {
  "wkid": 4326,
  "latestWkid": 4326
 },
 "fields": [
  {
   "name": "ProductId",
   "alias": "ProductId",
   "type": "esriFieldTypeInteger"
  }
 ],
 "features": [
  {
   "attributes": {
    "ProductId": 10175
   }
  }
 ]
}

My doubts are:

  • Is WKT format allowed as geometry input format in this endpoint? In case it is not allowed, why did it end with success instead of a wrong geometry "input format/invalid geometry" message?
  • In the other hand, if it is because of a wrong input WKT json, I need to know how to create a valid WKT json for points and polygons (I could not find enough esri documentation or topics in this forum talking about the WKT format when querying/adding geometries)
  • Is there any way to obtain from the API query endpoint, the features within a layer with the geometry in WKT format? I can only see PBF, Json and GeoJson as output formats. In case I could query an existing valid geometry and get the geometry in WKT, maybe I could use it as input in the addfeatures web form and try it.

If I use the normal json geometry for a Point, it works:

 

[{
    "geometry": {
      "x": 12.474212758000021,
      "y": 45.662661214000025
    },  
    "attributes": {
      "ProductId": 10175
    }
}]

 

Any help would be appreciated!

Thanks!

0 Kudos
0 Replies