In this video, Jennifer Harrison demonstrates how to write a script that uses ArcPy and the mapping module. Learn how to create a map document object and access the properties and methods of that map document.
- [Instructor] Let's walk through the process…of writing a script to get and reset…some map document properties and layer properties.…I'm in IDLE and I've got a script already open…that has a title block and a pseudo code for this script.…Now I'll fill in the code.…First, I'll have to import arcpy.…That's done in all lowercase.…Next, I'll create a variable to hold the map document name.…
In the future, this variable could be modified…to prompt the user for a map document name at run time,…but for now I'll just hard code it into the script.…I'm using camelcase for the variable name…and the first three letters indicates…that this variable is gonna hold a string.…I'm using the little R, which means raw,…to cancel out the special meaning of any characters…that might be in my directory path and file name here.…
My actual map document is Belize.mxd.…You don't have to set a variable for the map document name,…but it makes things a little easier later…because that path is so long.…So at this point that variable just holds a text string,…
- 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.