Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Programming ArcGIS 10.1 with Python Cookbook
  • Table Of Contents Toc
Programming ArcGIS 10.1 with Python Cookbook

Programming ArcGIS 10.1 with Python Cookbook

By : Donald Eric Pimpler, Eric Pimpler
4.2 (13)
close
close
Programming ArcGIS 10.1 with Python Cookbook

Programming ArcGIS 10.1 with Python Cookbook

4.2 (13)
By: Donald Eric Pimpler, Eric Pimpler

Overview of this book

ArcGIS is an industry standard geographic information system from ESRI.This book will show you how to use the Python programming language to create geoprocessing scripts, tools, and shortcuts for the ArcGIS Desktop environment.This book will make you a more effective and efficient GIS professional by showing you how to use the Python programming language with ArcGIS Desktop to automate geoprocessing tasks, manage map documents and layers, find and fix broken data links, edit data in feature classes and tables, and much more."Programming ArcGIS 10.1 with Python Cookbook" starts by covering fundamental Python programming concepts in an ArcGIS Desktop context. Using a how-to instruction style you'll then learn how to use Python to automate common important ArcGIS geoprocessing tasks.In this book you will also cover specific ArcGIS scripting topics which will help save you time and effort when working with ArcGIS. Topics include managing map document files, automating map production and printing, finding and fixing broken data sources, creating custom geoprocessing tools, and working with feature classes and tables, among others.In "Python ArcGIS 10.1 Programming Cookbook" you'll learn how to write geoprocessing scripts using a pragmatic approach designed around an approach of accomplishing specific tasks in a Cookbook style format.
Table of Contents (21 chapters)
close
close
Programming ArcGIS 10.1 with Python Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
3
Index

Scheduling batch files to run at prescribed times


Once created, your batch files can then be scheduled to run at prescribed times using the Windows Scheduler.

Getting ready

Many geoprocessing scripts are time-intensive and best run after hours when they can take full advantage of system resources and free up your time to concentrate on other tasks. In this recipe, you will learn how to use the Windows Scheduler to schedule the execution of your batch files.

How to do it...

Follow these steps to schedule a batch file with the Windows Scheduler:

  1. Open the Windows Scheduler by going to Start | Programs | Accessories | System Tools | Control Panel | Administrative Tools. Select Task Scheduler. The scheduler should appear, as shown in the following screenshot:

  2. Select the Action menu item and then Create Basic Task to display the Create Basic Task Wizard dialog box, as shown in the next screenshot.

  3. Give your task a name. In this case, we will call it List Fields from a Feature Class. Click on Next:

  4. Select a trigger for when the task should be executed. This can, and often will be, a time-based trigger, but there can also be other types of triggers such as a user login or computer start. In this case, let's just select Daily. Click on Next:

  5. Select a start date/time as well as a recurrence interval. In the following screenshot, I have selected the date as 12/3/2012, with time as 1:00:00 AM, and a recurrence interval of 1 day. So, every day at 1:00 AM, this task will be executed. Click on Next:

  6. Select Start a program as the action:

  7. Browse to your script and add the parameters. Click on Next:

  8. Click on Finish to add a task to the scheduler:

  9. The tasks should now be displayed in the list of active tasks:

How it works...

The Windows Task Scheduler keeps track of all the active tasks and handles the execution of these tasks when the prescribed trigger is fired. In this recipe, we have scheduled our task to execute each day at 1:00 AM. At that time, the batch file we created will be triggered and the arguments we specified when creating the task will be passed into the script. Using the scheduler to automatically execute geoprocessing tasks after hours without the need for GIS staff to interact with the scripts gives you more flexibility and increases your efficiency. You might also want to consider logging the errors in your Python scripts to a log file, for more information about specific problems.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Programming ArcGIS 10.1 with Python Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon