Select to view content in your preferred language

How to use Query() to pull intersecting features through a widget

3233
10
Jump to solution
02-17-2017 11:57 AM
StahlyEngineering
Occasional Contributor

How does one correctly use a query and QueryTask to retrieve features in a predefined layer that intersect a selected feature?

var queryTask = new QueryTask("http://services6.arcgis.com/3aTanasiPG0rbYg4/arcgis/rest/services/PlatBook_Test/FeatureServer/1");
var query = new Query();
query.returnGeometry = true;
query.outFields = ["SECDIVID"];
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
// execute query
queryTask.execute(query);

current piece of code spits out an error of faulty query arguments.

Once the query works the next task will be to output a specific field from the output into an array.

Any help is appreciated, I'm very new to writing scripts and have no idea what I'm doing.

Cheers!

0 Kudos
10 Replies
StahlyEngineering
Occasional Contributor

That did it. I suppose when the API documentation says one thing I still need to figure out what they meant, because the two are not always the same.

0 Kudos