Page Query in Definition Query

273
4
09-23-2021 04:54 AM
Labels (2)
RobertBorchert
Frequent Contributor III

You can use Page Query to turn layers on and off if an attribute in the layer matches the map series page name.  This is great but very limited and has no flexibility.

What I would like to know is there a way to limit visibility of a layer using Definition Query where a layer is visible depending  on the Map Series page in use?

0 Kudos
4 Replies
jcarlson
MVP Notable Contributor

We do this in a Map Series of ours, but have to use the arcpy.mp to do it. A built-in solution would be nice, though. I'll definitely upvote your idea on this.

- Josh Carlson
Kendall County GIS
RobertBorchert
Frequent Contributor III

I would be fine writing it out in SQL in the definition query.  But a drop down menu of selectable page names would be nice.

So is your script something that has to be executed each time or does it remain intact?

0 Kudos
jcarlson
MVP Notable Contributor

I run it once to get the entire series to export. It's for our annual tax map book, so the per-page query format doesn't change, just the attributes. The gist of it:

for feat in features:
    some_map.listLayers()[1].definitionQuery = f"some_attribute = {feat.attribute1} or some_attribute = {feat.attribute2}"
    # other layout things
    # export to PDF
- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

I may try something that.  This is for company wall maps and we will generate new PDF's of them 2 times a year, or after major restructuring. then if any of our employees or clients need a wall map they can plot it out.  

0 Kudos