1

Is there any way to use criteria beyond the page name for a map series in ArcGIS pro?

For example, I am making maps of a bunch of point-features in substate regions.

  1. Western half of state
  2. Eastern half of state
  3. Zoom in on a single city
  4. Repeat for another state (could be as many as ~10 maps for large states like CA or TX)

I cover those regions by creating an index layer that has rectangles covering my desired view and using that to drive the Map Series (and add dynamic text to the layout titles).

I'd like to be able to limit the point layer to only show points within the same state. E.g. when looking at the western half of the state, I don't want to see points from the next state over. If I were doing state maps, I would just set the Page Query on the point layer to only show dots where state = page state, but I can't do this when I cut to sub-state areas.

I also can't just add a column to the point layer that includes the sub-state area as these areas can overlap and I still want to see all the dots (I need to see the zoomed-in city dots also on the larger maps).

In the past I have worked around this by simply duplicating the features. If I have 3 sub-state regions, I just create 3 copies of the features in that state and give each one a label matching the page title. This works fine and displays exactly how I would expect it to. Unfortunately in this instance I have a very large number point features and it is not practical to duplicate them a bunch of times for each sub-state region as ArcGIS already takes a long time to draw everything and render the maps.

Another possible solution is to make the page name the state name. You end up with 3 pages with the same name, but you can use dynamic text to choose an attribute for the titles in the actual layout and this would correctly display the point layer. This won't work well in my situation either because I have another polygon layer where I do want to use page query based on the sub-state region.

Are there any other viable solutions here? It has always seemed very odd that ArcGIS doesn't allow you to do a Page Query based on ANY attribute in the index layer.

3
  • Duplicating points is easy - intersect them with polygons. I'd create a copy of polygons and modify towns by !shape!.buffer(500) and do intersect after.
    – FelixIP
    Feb 24, 2023 at 19:46
  • Thanks, yeah, duplicating the points isn't hard except that I have many millions of points in this case and it is already straining ArcGIS Pro. Machine has 512gb ram/32 cores and isn't near capacity, but ArcGIS is simply not happy. Doubt it will be happier with 5x the points. Wish they instead let you do a full SQL Page Query like they do with Definition Queries.
    – o.h
    Feb 25, 2023 at 1:29
  • Just save intersects in memory. I experienced no problem with over 5M points on machine with 32GB RAM. But I use ArcGIS 8, not Pro.
    – FelixIP
    Feb 25, 2023 at 1:55

3 Answers 3

2

Since you tagged this with arcpy, I'll offer up some options there that I've used to combine a definition query with a map series. Similar to your approach, I created an index layer with the information for the spatial map series (including scale, spatial reference system, rotation, etc...). I also store the code in a jupyter notebook in the project to easily run it whenever I need to export the series.

Basically, you can hook into the map series of the layout and use that information to change the definition query on a layer in the map.

#get the current project
aprx = arcpy.mp.ArcGISProject("CURRENT")
#get the layout that the map series is in
layout = aprx.listLayouts("layout name")[0]
#get the map that the point layer is in, or the map frame points to
bmap = aprx.listMaps("Map")[0]
#point layer
lyr = bmap.listLayers("Point Layer Name")[0]
#get the map series
ms = layout.mapSeries
#the map frame the series points to
mf = ms.mapFrame
# loop through the map series pages
for pageNum in range(1, ms.pageCount + 1):
    #set the map series to the current page number
    ms.currentPageNumber = pageNum
    #get the name of the map series page
    st_nm = ms.pageRow.name
    #use the map series information to set a definition query on the layer
    #you could create a dictionary in python that has a lookup query for each page
    layer.definitionQuery = "state = '{0}'".format(st_nm)
    #export to a pdf
    layout.exportToPDF("name of the pdf", 300, 'BEST',output_as_image=True)        
    
2
  • Thanks, I'm going to mark this as accepted as it is a reasonable solution (although it looks like "name of the pdf" needs to be dynamically created as this won't output to a single multi-page PDF. I do wish they'd open up more complex page queries for purposes like this since it would allow for using the standard Map Series/Export interface.
    – o.h
    Feb 28, 2023 at 1:18
  • That's correct. I was able to combine them after with Acrobat, but that may not be available to everyone. You might be able to stitch them together with a Python library. stackoverflow.com/questions/3444645/merge-pdf-files
    – dslamb
    Feb 28, 2023 at 12:47
1

You can stitch the pdfs together within arcpy by creating a blank pdf and then appending pages to it as they are created. ESRI has some documentation on this as well, but here is a snippet from a project I've been working on.

#Get club name from map series row to use in file name
clubName = lyt.mapSeries.pageRow.Club_Name
pdfFileName = clubName + ' Sign Inspection.pdf' 
    
#Create a new PDF where layouts will be appended into
#First remove the file if it already exists
if os.path.exists(os.path.join(outputFolder, pdfFileName)):
  os.remove(os.path.join(outputFolder, pdfFileName))
pdf = arcpy.mp.PDFDocumentCreate(os.path.join(outputFolder, pdfFileName))

#This was copied from inside of a loop that iterates over a list of pageNames, 
#so that multiple pages are appended into the empty pdf that was created.
    #export layout to pdf
    lyt.exportToPDF(os.path.join(outputFolder, pageName +  '.pdf'))

    #append exported layout to the pdf variable created above
    pdf.appendPages(os.path.join(outputFolder, pageName +  '.pdf'))

    #Remove the single, exported page after appended into final PDF
    os.remove(os.path.join(outputFolder, pageName + '.pdf'))
-1

here is the simple ArcGIS Pro process to do what you want, you wan add a query to your city layer to only show the Map Series state shown.

https://pro.arcgis.com/en/pro-app/latest/help/layouts/page-queries.htm

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 4, 2023 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.