I would like to be able to apply a spatial definition query to a layer.
I.e. Select features from this pointlayer that are within a feature from buildingpolygons.
Defining a query must be as easy as it can be done in the Select By Location dialog.
The result of the query is updated when features that are involved are modified.
For what it's worth, the Select Layer by Location GP tool has an "Intersect (DBMS)" option, which creates a database view that has a spatial SQL query:
View name: SELECTIONOUTPUTNAME
select "OBJECTID" from ( SELECT a.OBJECTID FROM INFRASTR.ACTIVE_TRANSPORTATION a,
INFRASTR.AGOL_PARKINGLOT b WHERE SDE.ST_INTERSECTS(a.SHAPE, b.SHAPE) = 1 ) esri_sql
In a pinch, I wonder if a person could use the SQL from that view to write a spatial definition query:
objectid in ( select a.objectid from infrastr.active_transportation a,
infrastr.agol_parkinglot b where sde.st_intersects(a.shape, b.shape) = 1 )
Related: Select Layer by Location — Intersect (DBMS) — Create a query layer instead of a database view
I can't believe that this functionality isn't there yet. GeoMedia has had it for 20 years. But it also has offered other types of querying capabilities that Esri just hasn't done in their products. At present, outputting a new feature class isn't acceptable, but that is all we have.
Merged from a separate idea: “Select By Location” Feature Layer — Spatial query that is fast, modifiable, and refreshable
The idea was previously named: "Convert selected features from Select By Location into a fully-functional feature layer"
We need spatial queries that are:
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?
We would 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 they 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.
What does the UI for this functionality look like? Are the spatial definition queries created via the layer properties or via a GP tool?
We are in the early stage of the development therefore a lot of things can change before we release this functionality. The current plan is to use the layer Properties page to set spatial def query just the way you do it for attribute definition query.
Please continue to give us your feedback. We appreciate them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.