Select to view content in your preferred language

Select by Attribute & zoom to selection

778
2
01-27-2022 08:41 AM
MikePowell1
New Contributor

I have section maps that we update daily, when something has been modified within that section. This is scripted in python for ArcMap and works great. It is based off mxds. For obvious reasons we are trying to move to ArcGIS Pro now and I am trying to convert/make a new script that will work with .aprx now. The maps have 2 insets, one showing the county view, one showing the Township view, and than the main map showing the section. It takes a simple text file that only has in it a list of township range and section (2N25E17 for example). Uses that list to go to the appropriate layer, in each inset, select that township Range Section and zooms to it on each map inset and than creates a pdf and jpg. I can not, get the insets to zoom to the appropriate section and township. I am not even sure I am making a selection correctly. I attached the code that I have so far, as well as how the map is suppose to look. Looking for any ideas on what I am doing wrong. I do have python knowledge but that was with Map and 2.7 Python now we are using Pro 2.9 and Python 3.7 and I am have some issues with some of my scripts that worked with mxds and converting them over to aprx. I took my existing mxds and just imported them into a aprx but I am wondering if I need to make a brand new aprx and skip the import. Any help would be appreciated, Thanks in advance

0 Kudos
2 Replies
RobBurke
Occasional Contributor

Hi Mike,

Did you ever solve your issue?  It may be helpful to narrow down, if when you test run the script can you set some breakpoints and evaluate the contents of some variables like mapframe, layer_extent, Addr, dfAddr, lyrAddr, just to make sure they are containing expected values.  Also after changing the camera position in code, are you using:

aprx.saveACopy("c:\Esrifolder\myproject.aprx)

Robert Burke
0 Kudos
MikePowell1
New Contributor

Thanks for the reply. sorry I didn't get to this until now. I understand what you are saying but not sure how to show my what the variables are. I am assuming with print statements but those don't come across where I can understand it because it is look for feature classes and attributes within the feature class. Also would I have to save a copy of the project for each one I make? Because there are times that my list is long I am would hate to have to save a new project every time. Each Township Range Section has 7 maps that is attributed to it. This is just one part, but if I can get this to work I can use it in the other sections. I am sure that I am just need to think of this completely different than the way I had it before. I was hoping that I didn't have to go that extreme with converting over to Pro.

0 Kudos