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?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked May 30, 2018 at 11:55

1 Answer 1

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.

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.