Does anyone know if there is anyway to access a feature layer's Display Filter query functionality from arcpy?
As an example, let's say I have a point feature layer with 5 point features. I'm going to create 2 buffers around each point, then export a layout PDF for each point showing the point with its 2 buffers. While it's possible to extract each point, buffer it twice, then generate the export, it seems more efficient to create the buffers for all of the points at once, then toggle visibility for the "screen grab" by selecting the correct feature in a layer. Unfortunately, lot's of internet searching hasn't provided any clues about whether I can control a layer's Display Filter query programmatically vs. only by the user interface. Although I suspect that functionality is NOT exposed, I figured I'd ask here before I gave up.
Solved! Go to Solution.
Steve,
The ArcPy.mp Layer class also has a property for Definition Queries.
Is this what you're looking for?
Tom
Hi Steve,
I'm assuming that by "display filter" you are talking about the visibility of the layer. Whether it is on or off. Visible or not. And you're not talking about visibility based on scale or filtering features within the layer based on queries.
If I'm correct in my assumptions then I believe you can do this using the visible property on the Layer class.
You might also find an example of this in the Thematic Map Series sample.
Here is a link for all the ArcPy samples: https://esriurl.com/8899.
Hope this helps,
Tom
Tom,
Thank you for your reply. I wasn't as clear as I should have been. I'm looking to control the visibility of individual features within an already visible feature layer (i.e. visibility is toggled "ON").
Each feature layer has the ability to add a "Definition Query" (limits the data included in the layer) and/or a "Display Filter." The Display Filter allows you to control which features within that layer are displayed based upon some criteria, separate from whether the layer as a whole is visible. ( Use display filters ) Most typically, this would probably be a scale criteria which helps you limit clutter on you map, but it doesn't have to be just scale, you can set them manually. Unfortunately, I've only been able to find out how to do this through the user interface, NOT through ArcPy.
I suspect I'm out of luck on this one.
Steve,
The ArcPy.mp Layer class also has a property for Definition Queries.
Is this what you're looking for?
Tom
Tom,
Great call! I was so focused on the Display Filter approach, I didn't think about exploring the Definition Query as a way to go. Since I don't need to have the full range of data available to the layer at capture point, there are no Symbology-related issues & no reason not to limit the layer's "data membership" vs. trying to change which data is being displayed.
I gave it a try & it works great. The one thing I had to work out was that using lyr.definitionQuery was appending (vs. replacing) any existing queries. lyr.definitionQuery = "" didn't do it for me. Where I ended up was ( 'cBuffLyr' is the layer with multiple buffer features in it ) :
Thanks again, Steve