In this video, Jennifer Harrison discusses the importance of making your scripts flexible by using command-line arguments. Learn the two ways that command-line arguments are captured: first in Python and then using ArcPy.
- [Instructor] When Python scripts are written to run…in ArcGIS, those scripts are usually not designed…to work on the same data set every time they run.…They're flexible enough to run…on different data sets and with different inputs.…We do this by allowing command-line arguments,…also called parameters, to be passed…into the script when it's run.…Some examples of why command-line arguments…might be used include, allow your script to work…on whatever map document the user wants.…
You could capture the map document name at runtime.…Let the user specify the output coordinate system.…You could capture the output coordinate system at runtime.…ArcMap Tools already work that way.…Over here in ArcMap, if we look at Toolbox,…and I run a tool, like possibly just the buffer tool,…all the options that are needed…to run the buffer tool can be specified…each time I run it, it's a very flexible tool.…
When you write a Python script,…there is a way to allow these input parameters as well.…And if your script interacts with ArcMap,…
- Writing and running Python scripts in IDLE
- Making scripts flexible with variables
- Commenting scripts
- Manipulating string data
- Object-oriented programming in Python
- Creating loops
- Reading and writing text files
- Capturing input at runtime
- Documenting your scripts
Skill Level Beginner
1. Python for ArcGIS Basics
2. Strings, Numbers, and Variables
Work with numeric values5m 22s
3. Syntax Rules
4. Manipulating Strings
5. Object-Oriented Programming
6. Using Loops
7. Generate Log Files
8. Input at Run Time
9. Help Documents
Documenting a script1m 59s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.