Automating Workflow With Python

4112
5
06-09-2016 08:46 AM
PaigeBrochu
New Contributor II

I am new to python scripting and want to script this workflow:

  1.      Join a table with a polygon layer
  2.      Export joined polygon layer as new layer
  3.      Remove join from original polygon layer
  4.      Customize a map layout that has two data frames - that changes depending on table joined at the beginning (includes a title, legend, and custom layer symbology).
  5.      Export as PDF

I have basic knowledge of python and have figured out the 1st and 2nd step but I am really confused how to remove the join from the beginning. Any scripting tips would really help!

-Paige

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

The trick is to try and do everything with tools in arctoolbox as much as possible.

Do the procedure once, then open the Results window and copy to a python snippet.

here is the remove join tool Remove Join—Help | ArcGIS for Desktop

0 Kudos
WesMiller
Regular Contributor III

You will also need to pre-create the elements you want in a map document(dataframes legend ect.) you can move the objects around but not create them.

0 Kudos
curtvprice
MVP Esteemed Contributor
I am really confused how to remove the join from the beginning.

Is the Remove Join tool not working? The tricky part is to find the name of the join, which can vary by format.

arcpy.Describe(<join_table>).name usually gets  you what you need for the argument to Remove Join.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Moved to Python​ to see if further responses might arise.

0 Kudos
LeileiDuan1
New Contributor III

I think one of the approach to make it easier to understand arcpy workflow is to build it in ModelBuilder first, then export the model into python script. That may give an idea of how the script can be structured. Overall it sounds like a data driven page problem. See this post. Hope this helps...

0 Kudos