“Select By Location” Feature Layer — Spatial query that is fast, modifiable, and refreshable

338
2
03-26-2023 06:36 AM
Status: Open
Labels (1)
Bud
by
Frequent Contributor II

We need spatial queries that are:

  • Fast
  • Easy to set up
  • Dynamic
  • Modifiable
  • Refreshable

One option would be Spatial SQL Definition Queries. But as mentioned in that idea, spatial database operations are notoriously slow and are difficult to set up correctly (as @JoshuaBixby mentions in a comment here).

So I'm wondering if “Select By Location” functionality could be used as an alternative mechanism, since that tool is surprisingly fast, even for large datasets.

Idea:
Could functionality be added to ArcGIS Pro that lets us convert the selected features from Select By Location into a fully-functional feature layer? 

Details below.

2 Comments
Bud
by

The layer needs to be refreshable:

  1. Refresh the layer dynamically. When the map refreshes, the spatial operation automatically re-queries.
  2. Or, the user could choose to manually refresh the layer as needed.
  3. Or, get clever with it and only automatically refresh the layer if the underlying data has changed (Similar to Oracle’s result cache mechanism). Or refresh on a user-defined schedule, such as every 5 minutes. Or re-query ahead of time in the background, so that the data is pre-queried for the next time we use it in the map. Kind of like what Google Chrome does with browser tabs.
    Related: Control caching settings for better performance in event layers & query layers

We would also need the ability to modify the Select By Location parameters after the feature layer was created. For example, put modifiable Select By Location parameters right in the layer properties. Or a button that brings up the Select By Location window with the existing layer's settings preloaded, ready to be adjusted and rerun. 


I’m aware that it’s possible to create a layer from a selection using the Create Layer from Selected Features tool. But I don’t think those layers are dynamic/modifiable/refreshable, so have limited use.

It might be possible to create a model or Python script to produce FCs that are similar to what we want — output a FC using spatial operations and re-run the script on-demand to replace the data. But that would require time, effort, and skill to develop. And couldn’t be refreshed automatically. Further, even manual refreshing would be slow because ArcPy is slow to initialize compared to Select By Location.


One of the benefits of this idea is that it would use ArcObjects, which means it would support all datatypes, such as file geodatabases.
Whereas the Spatial SQL Definition Query idea would only work for datatypes that have spatial functions in the database, such as enterprise and mobile geodatabases, not file geodatabases.

I suppose, behind the scenes, the layer would be a list of objectids, which is somewhat similar to "Create Layer from Selected Features". But the difference would be: the layer is modifiable and refreshable. I wonder if the underlying query that's sent to the database would look like this:

  • WHERE OBJECTID IN (1,2,3...)    The result of Select By Location.
  • AND {definition query logic, etc.}


Would something like that be possible? It seems like it would be very useful.