Definition query on a query layer?

423
1
Jump to solution
04-12-2023 07:36 AM
Labels (1)
Bud
by
Frequent Contributor III

ArcGIS Pro 2.6.8; Oracle 18c 10.7.1 EGDB

I noticed recently that it's possible to create a definition query on a query layer:

Bud_0-1681309813559.png

I suppose that makes sense. All feature layers in the Contents pane have a definition query section in the layer properties, including query layers.

Out of curiosity, does anyone ever do that -- have a query layer that has a WHERE clause in the SQL definition, and have a definition query too? If so, what's the use case?

It might seem a bit strange to have WHERE clauses in both places. But I suppose definition queries are more convenient to modify than query layer SQL definitions, so maybe that's a reason to do it?

Thoughts?

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

This is a definite edge case, but we have a database that pulls everything from OpenStreetMap for our county and keeps them in generalized tables (with an hstore column "tags" holding all the attributes).

If I'm doing something with transportation, I'll have a WHERE clause like

tags -> 'highway' is not null

 to get the routable linear features. But I may want to toggle whole categories of features on and off within that layer, so a definition query to focus on pedestrian or cycling features can be handy, so having a handful of definition queries makes it easy to flip between different sets.

To me, the WHERE clause is for a filter I don't ever mean to adjust, it's part of the layer's "definition". The definition query, though, is more like a "filter widget" to me, and is something I intend to turn on and off as needed.

Of course, using discrete parameters in the query can accomplish that, too, for simpler use cases.

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Esteemed Contributor

This is a definite edge case, but we have a database that pulls everything from OpenStreetMap for our county and keeps them in generalized tables (with an hstore column "tags" holding all the attributes).

If I'm doing something with transportation, I'll have a WHERE clause like

tags -> 'highway' is not null

 to get the routable linear features. But I may want to toggle whole categories of features on and off within that layer, so a definition query to focus on pedestrian or cycling features can be handy, so having a handful of definition queries makes it easy to flip between different sets.

To me, the WHERE clause is for a filter I don't ever mean to adjust, it's part of the layer's "definition". The definition query, though, is more like a "filter widget" to me, and is something I intend to turn on and off as needed.

Of course, using discrete parameters in the query can accomplish that, too, for simpler use cases.

- Josh Carlson
Kendall County GIS