售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Programming ArcGIS with Python Cookbook Second Edition
Table of Contents
Programming ArcGIS with Python Cookbook Second Edition
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
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
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
Using the ArcGIS Python window
The ArcGIS Python window
Displaying the ArcGIS Python window
Python language fundamentals
Commenting code
Importing modules
Variables
Built-in data types
Strings
String manipulation
Numbers
Lists
Tuples
Dictionaries
Classes and objects
Statements
Decision support statements
Looping statements
Try statements
With statements
Statement indentation
File I/O
Summary
2. 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…
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…
Zooming in to selected features
Getting ready
How to do it…
How it works…
Changing the map extent
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…
Working with time-enabled layers in a data frame
Getting ready
How to do it...
How it works…
3. 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 broken data sources in all map documents in a folder
Getting ready
How to do it...
How it works...
4. 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 the properties of layout elements
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…
Exporting a report
Getting ready
How to do it…
How it works…
Building a map book with Data Driven Pages and ArcPy mapping
Getting ready
How to do it…
How it works…
Publishing a map document to an ArcGIS Server service
Getting ready
How to do it…
How it works…
5. 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...
6. Creating Custom Geoprocessing Tools
Introduction
Creating a custom geoprocessing tool
Getting ready
How to do it…
How it works…
There's more...
Creating a Python toolbox
Getting ready
How to do it…
How it works…
7. Querying and Selecting Data
Introduction
Constructing a 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...
8. Using the ArcPy Data Access Module with Feature Classes and Tables
Introduction
Retrieving features from a feature class with 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 UpdateCursor
Getting ready
How to do it…
How it works…
Deleting rows with 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…
Using Walk() to navigate directories
Getting ready
How to do it…
How it works…
9. Listing and Describing GIS Data
Introduction
Working with the ArcPy list functions
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 a raster image
Getting ready
How to do it…
How it works…
10. 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 and using the Python add-ins module
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...
11. 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/else)
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 the level of severity
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…
12. Using Python for Advanced ArcGIS
Introduction
Getting started with the ArcGIS REST API
Getting ready
How to do it…
How it works…
Making HTTP requests and parsing the response with Python
Getting ready
How to do it…
How it works…
Getting layer information with the ArcGIS REST API and Python
Getting ready
How to do it…
How it works…
Exporting a map with the ArcGIS REST API and Python
Getting ready
How to do it…
How it works…
Querying a map service with the ArcGIS REST API and Python
Getting ready
How to do it…
How it works…
Geocoding with the Esri World Geocoding Service
Getting ready
How to do it…
How it works…
Using FieldMap and FieldMappings
Getting ready
How to do it…
How it works…
Using a ValueTable to provide multivalue input to a tool
Getting ready
How to do it…
How it works…
13. Using Python with ArcGIS Pro
Introduction
Using the new Python window in ArcGIS Pro
Coding differences between ArcGIS for Desktop and ArcGIS Pro
Installing Python for ArcGIS Pro
Converting ArcGIS for Desktop Python code to ArcGIS Pro
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 Python Recipes Every GIS Programmer Should Know
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
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜