Page Definition Query for another layer
I have one data frame showing polygons where various languages are spoken. Some of these polygons run over country borders. This data frame is run by Data Driven Pages, such that there is a separate map for each language group. On my layout, I have a separate data frame showing the extent for the first data frame. I want, in the second data frame, to outline the country polygons that the language polygon falls inside of. I tried to set up a Page Definition query to only show the countries that match the current page, however there is no field in the countries attribute table that contains the language name, so the Page Definition query does not work. I have tried to come up with some way to join the languages table and the countries table, so that the language name could be associated with the country name and thus symbolized. However, since there are multiple language polygons per country and multiple countries that each language falls inside of, the join does not work, since it's a many-to-many relationship. Is there any way that I can symbolize the countries based on the language polygon per each data-driven page? Thank you!
Mapping Center Answer:
I think you're asking is how to select the countries that intersect each language polygon and highlight those countries in the locator map as it cycles through the data driven pages that are indexed on language polygons.
One idea is to use Python and write a short script to make this happen. You might be able to do it with a page definition query if the data were set up correctly but that might be harder than a straight script approach.
The script would look something like:
mxd = arcpy.mapping.MapDocument (PATH TO DDP MXD)
for page in range (1, mxd.dataDrivenPages.pageCount + 1) :
mxd.dataDrivenPages.currentPageID = page
countries = layer that will display countries in locator dataframe
language = layer that has polygons of language
selected = arcpy.SelectLayerbyLocation_management (countries, "INTERSECT", language)
arcpy.MakeFeatureLayer_management (selected, temp_countries)
tempPDF = path to a temporary pdf
arcpy.mapping.ExportToPDF (mxd, tempPDF)
then append the tempPDF to a final PDF and delete tempPDF.
If you would like to post a comment, please login.