1 / 33

Automating Processes with ArcPy to do work so I don’t have to

Automating Processes with ArcPy to do work so I don’t have to. Joe Guzi GIS Systems Analyst Stark County GIS Department. 2015 Ohio GIS Conference. September 21 - 23, 2015 | Hyatt Regency Columbus| Columbus, Ohio. Why Automate processes?. Not only to do work so I don’t have to

rdeangelo
Download Presentation

Automating Processes with ArcPy to do work so I don’t have to

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automating Processes with ArcPy to do work so I don’t have to Joe Guzi GIS Systems Analyst Stark County GIS Department 2015 Ohio GIS Conference September 21 - 23, 2015 | Hyatt Regency Columbus| Columbus, Ohio

  2. Why Automate processes? • Not only to do work so I don’t have to • But mainly to Free me up to do more work

  3. Why do more work? • Because work leads to Taking Over the world!

  4. Automaton Strategies • Walk through Process • Test • Be prepared • Task Scheduler and BAT Files • Maintenance • Excel Sheet To Maintain Schedule • Code Examples

  5. Automaton Strategies:Walk through process

  6. Automaton Strategies:Walk through process

  7. Automaton Strategies:Walk through process

  8. Automaton Strategies:Test

  9. Automaton Strategies:Test

  10. Automaton Strategies:Test Again

  11. Automaton Strategies:Task Scheduler and BAT Files

  12. Automaton Strategies:Task Scheduler and BAT Files • Bat Files • Just Text Files saved with a bat extension • Written using DOS Commands • Syntax

  13. Automaton Strategies:Task Scheduler and BAT Files

  14. Automaton Strategies:Task Scheduler and BAT Files • Task Scheduler Parameters: • Trigger – Declare when the task will run and how frequently • Actions – Declare what the Task will do • Conditions – Declare computer setting for power or idle • Settings – Determine how the task can be treated • Allow the task to run on demand • Stop the task if it takes forever

  15. Excel Sheet to Maintain Schedule

  16. Code Examples

  17. Code Examples:Layer Update Automation

  18. Code Examples:Feature Update Email Notification

  19. Code Examples:Automation of Tax Map Updates

  20. Code Examples:Cache Error Detection

  21. Python Tips and Tricks • Section your code • Comment Comment Comment • Use Print Command • Error Block • Email Notification • Create Logs • Time • Use Resources

  22. Python Tips and Tricks:Section your code • Description • Import Section • Variables • Processes • Output • Error Reporting

  23. Python Tips and Tricks: Comment Comment Comment • Comment everything • If you change your code comment the change • You never know when you will have to come back to your code and commenting will be the best way to remember why you did something • Also commenting is good back up in case something happened to the author (God forbid)

  24. Python Tips and Tricks: Comment Comment Comment

  25. Python Tips and Tricks: Use the print Command

  26. Python Tips and Tricks: Error blocks

  27. Python Tips and Tricks: Email Notification

  28. Python Tips and Tricks: Create logs

  29. Python Tips and Tricks: Time • Time Libraries: • Time • Datetime • Time.gmtime • datetime.datetime.utcnow() • datetime.timedelta(minutes = 15) • str(DayAgo)[0:19] • "( LAST_EDITED_DATE >= '" + DayAgoFormat + "' )"

  30. Python Tips and Tricks: Use Resources • Python Window in ArcGIS desktop • ArcGIS Resources Python Section • Geoprocessing Tool References • GitHub • Friends • Python Documentation Site

  31. Questions? • Joe Guzi • jsguzi@starkcountyohio.gov • 330-451-7188

More Related