Select to view content in your preferred language

Embed the geometry result from a rest endpoint query into the input geometry of another query

1385
2
08-26-2021 01:56 AM
js24
by
Emerging Contributor

I would like to query a feature from a rest end point, return a geometry for that feature, and then use that geometry as the "input geometry" in a spatial query on a second different rest endpoint. Is it possible to do this in a single call to the second rest endpoint?

For example, I have tried to put the initial query url (with 'return geometry = yes') into the input geometry parameter for the second spatial query but this doesn't work because the result of the query is not the correct format for the input geometry parameter.

JillSlater1_0-1629967953542.png

Is there a way to query for a geometry so that the result can be used as input to another query?

 

0 Kudos
2 Replies
VictorTey
Esri Contributor

Hi, when you make the query for the geometry, you can set the format to json

VictorTey_0-1630321037428.png

then the result you get in json can be used. However from your screenshot I am unable to tell what you are trying to do as that doesn't look like geometry to me. which rest endpoint is that?

VictorTey_1-1630321086893.png

I typically use the applyedit end point and the json response works well for me

VictorTey_2-1630321183097.png

 

0 Kudos
js24
by
Emerging Contributor

Hi Victor, thanks for your reply.

I am querying in a map service and not a feature service which might be part of the problem.

When I query for features and return the geometry in json format, I can see the geometries in the result, but there are also a number of other attributes and details in the json result that I can not use as geometry input in a second spatial query.

js24_1-1630673346289.png

The format required for geometry input into a rest endpoint query is only the geometries according to this documentation, Geometry objects—Common Data Types | ArcGIS for Developers. I basically have to manually strip out the geometry values from the json respose of my first query, and manually enter them into my second query. So I am trying to remove this step of properly formatting the json geometry values to be used in a second, spatial query.

 

0 Kudos