1

I've developed an application which loads the services from the ArcGIS Server via REST API.

I load a service, the service has multiple layers, each layer has multiple features (objects).

By the URL http://domain/arcgis/rest/services/Test/MapServer/3/query?f=json&where=1%3D1&returnGeometry=false&outFields=* I get all features of a layer.

When I click on the map, I get the Lat/long of the point. I want to load all features which contain this point. How should I generate the URL?

2

You would need to set the geometry parameter in the request, as described in the documentation here

Description: The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, for envelopes and points, you can specify the geometry with a simpler comma-separated syntax.

Syntax:

geometryType=esriGeometryEnvelope&geometry={xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}

geometryType=esriGeometryEnvelope&geometry=-104,35.6,-94.32,41

geometryType=esriGeometryPoint&geometry=-104,35.6

In general, if you're unsure about the specific format of the URL, open http://domain/arcgis/rest/services/Test/MapServer/3/query in a browser. This will give you the basic interface for querying a Mapservice. Press the Query button and inspect the resulting URL. If needed, you can trim unneeded parameters.

  • I tried this... If the features are polygons, and my point is [50,40], how should I generate the URL? – Leeloo May 30 '18 at 12:11
  • BTW your link doesn't work – Leeloo May 30 '18 at 12:12
  • The 3rd syntax example shows exactly that: geometryType=esriGeometryPoint&geometry=50,40 – Berend May 30 '18 at 12:12
  • I fixed the URL – Berend May 30 '18 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.