售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Programming ArcGIS 10.1 with Python Cookbook
Table of Contents
Programming ArcGIS 10.1 with Python Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Fundamentals of the Python Language for ArcGIS
Using IDLE for Python script development
The Python shell window
The Python script window
Editing existing Python scripts
Executing scripts from IDLE
Python language fundamentals
Commenting code
Importing modules
Variables
Built-in datatypes
Strings
String manipulation
Numbers
Lists
Tuples
Dictionaries
Classes and objects
Statements
Decision support statements
Looping statements
Try statements
with statements
File I/O
Summary
2. Writing Basic Geoprocessing Scripts with ArcPy
Introduction
Using the ArcGIS Python window
Getting ready
How to do it…
Accessing ArcPy with Python
Getting ready
How to do it…
How it works…
Executing tools from a script
How to do it…
How it works…
There's more…
Using ArcGIS Desktop help
Getting ready
How to do it...
How it works...
Using variables to store data
Getting ready
How to do it...
How it works...
Accessing ArcPy modules with Python
Getting ready
How to do it…
How it works…
3. Managing Map Documents and Layers
Introduction
Referencing the current map document
Getting ready
How to do it…
How it works
Referencing map documents on a disk
Getting ready
How to do it…
How it works…
Accessing a data frame
Getting ready
How to do it...
How it works...
Getting a list of layers in a map document
Getting ready
How to do it…
How it works…
There's more…
Restricting the list of layers
Getting ready
How to do it…
How it works…
Changing the map extent
Getting ready
How to do it...
How it works...
Getting a list of tables
Getting ready
How to do it…
How it works…
Adding layers to a map document
Getting ready
How to do it…
How it works…
There's more…
Inserting layers into a map document
Getting ready
How to do it…
How it works…
There's more…
Updating layer symbology
Getting ready
How to do it…
How it works…
There's more...
Updating layer properties
Getting ready
How to do it…
4. Finding and Fixing Broken Data Links
Introduction
Finding broken data sources in your map document and layer files
Getting ready
How to do it…
How it works…
There's more…
Fixing broken data sources with MapDocument.findAndReplaceWorkspacePaths()
Getting ready
How to do it…
How it works…
There's more…
Fixing broken data sources with MapDocument.replaceWorkspaces()
Getting ready
How to do it…
How it works…
Fixing individual Layer and Table objects with replaceDataSource()
Getting ready
How to do it…
How it works…
There's more…
Finding all broken data sources in all map documents in a folder
Getting ready
How to do it...
How it works...
5. Automating Map Production and Printing
Introduction
Creating a list of layout elements
Getting ready...
How to do it…
How it works…
Assigning a unique name to layout elements
Getting ready
How to do it…
How it works…
There's more…
Restricting the layout elements returned by ListLayoutElements()
Getting ready
How to do it…
How it works...
Updating layout element properties
Getting ready
How to do it…
How it works...
Getting a list of available printers
Getting ready
How to do it…
How it works...
Printing maps with PrintMap()
Getting ready
How to do it…
How it works...
Exporting a map to a PDF file
Getting ready
How to do it…
How it works…
Exporting a map to an image file
Getting ready
How to do it…
How it works…
Creating a map book with PDFDocumentCreate() and PDFDocumentOpen()
Getting ready
How to do it…
How it works...
There's more…
6. Executing Geoprocessing Tools from Scripts
Introduction
Finding geoprocessing tools
Getting ready
How to do it…
How it works…
Retrieving a toolbox alias
Getting ready
How to do it…
How it works…
Executing geoprocessing tools from a script
Getting ready
How to do it…
How it works…
There's more...
Using the output of a tool as an input to another tool
Getting ready
How to do it...
How it works...
Setting environment variables and examining tool messages
Getting ready
How to do it…
How it works…
7. Creating Custom Geoprocessing Tools
Introduction
Creating a custom geoprocessing tool
Getting ready
How to do it…
How it works…
There's more...
8. Querying and Selecting Data
Introduction
Constructing proper attribute query syntax
Getting ready
How to do it…
How it works…
Creating feature layers and table views
Getting ready
How to do it…
How it works...
There's more...
Selecting features and rows with the Select Layer by Attribute tool
Getting ready
How to do it…
How it works…
Selecting features with the Select by Location tool
Getting ready
How to do it…
How it works…
Combining a spatial and attribute query with the Select by Location tool
Getting ready
How to do it...
How it works...
9. Using the ArcPy Data Access Module to Select, Insert, and Update Geographic Data and Tables
Introduction
Retrieving features from a feature class with a SearchCursor
Getting ready
How to do it…
How it works…
Filtering records with a where clause
Getting ready
How to do it…
How it works…
Improving cursor performance with geometry tokens
Getting ready
How to do it…
How it works…
Inserting rows with InsertCursor
Getting ready
How to do it…
How it works…
Updating rows with an UpdateCursor
Getting ready
How to do it…
How it works…
Deleting rows with an UpdateCursor
Getting ready
How to do it…
How it works…
Inserting and updating rows inside an edit session
Getting ready
How to do it…
How it works…
Reading geometry from a feature class
Getting ready
How to do it…
How it works…
10. Listing and Describing GIS Data
Introduction
Getting a list of feature classes in a workspace
Getting ready
How to do it…
How it works…
There's more…
Restricting the list of feature classes returned with a wildcard
Getting ready
How to do it…
How it works…
Restricting the list of feature classes returned with a feature type.
Getting ready
How to do it…
How it works…
There's more...
Getting a list of fields in a feature class or table
Getting ready
How to do it…
How it works…
Using the Describe() function to return descriptive information about a feature class
Getting ready
How to do it…
How it works…
Using the Describe() function to return descriptive information about an image
Getting ready
How to do it…
How it works…
Returning workspace information with the Describe() function
Getting ready
How to do it…
How it works…
11. Customizing the ArcGIS Interface with Add-Ins
Introduction
Downloading and installing the Python Add-In wizard
Getting ready
How to do it…
How it works…
Creating a button add-in
Getting ready
How to do it...
How it works...
Installing and testing an add-in
Getting ready
How to do it…
How it works…
Creating a tool add-in
Getting ready
How to do it...
How it works...
There's more…
12. Error Handling and Troubleshooting
Introduction
Exploring the default Python error message
Getting ready
How to do it…
How it works…
Adding Python exception handling structures (try/except/finally)
Getting ready
How to do it…
How it works…
There's more…
Retrieving tool messages with GetMessages()
Getting ready
How to do it…
How it works…
Filtering tool messages by severity level
Getting ready
How to do it…
How it works…
Testing for and responding to specific error messages
Getting ready…
How to do it…
How it works…
Returning individual messages with GetMessage()
Getting ready
How to do it...
How it works...
A. Automating Python Scripts
Introduction
Running Python scripts from the command line
Getting ready
How to do it…
How it works…
Using sys.argv[ ] to capture command-line input
Getting ready
How to do it...
How it works...
Adding Python scripts to batch files
Getting ready
How to do it...
How it works...
There's more...
Scheduling batch files to run at prescribed times
Getting ready
How to do it...
How it works...
B. Five Things Every GIS Programmer Should Know How to Do with Python
Introduction
Reading data from a delimited text file
Getting ready
How to do it…
How it works…
There's more...
Sending e-mails
Getting ready
How to do it…
How it works…
Retrieving files from an FTP server
Getting ready
How to do it…
How it works…
There's more…
Creating ZIP files
Getting ready
How to do it…
How it works…
There's more…
Reading XML files
Getting ready
How to do it…
How it works…
There's more…
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜