Is it possible to perform the equivalent of "select by location" in the ArcGIS Server JavaScript API v4.x? The use-case is "find features in Layer 1 which are within x kilometres of features in Layer 2".
Here are the options I've considered:
- a QueryTask with Query.geometry - this will query an entire layer, but only has the option to query against a single geometry object, not another layer
- GeometryEngine.intersect - only works between 2 geometry objects, not 2 layers
- The FindExistingLocations spatial analysis service, which seems to require special licensing which I don't have (I don't have access to ArcGIS Portal on this project)
- Use the GeometryEngine.intersect approach in a JavaScript loop - which would require comparing every feature in both layers against each other (?)
I'm a little surprised that something so commonplace in a desktop GIS doesn't seem to be easily achievable in a web map. Am I missing something obvious?