ArcPy and ArcGIS – Geospatial Analysis with Python
eBook - ePub

ArcPy and ArcGIS – Geospatial Analysis with Python

Silas Toms

Compartir libro
  1. 224 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

ArcPy and ArcGIS – Geospatial Analysis with Python

Silas Toms

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

About This Book

  • Perform GIS analysis faster by automating tasks, such as selecting data or buffering data, by accessing GIS tools using scripting
  • Access the spatial data contained within shapefiles and geodatabases, for updates, analysis and even transformation between spatial reference systems
  • Produce map books and automate the mapping of geospatial analyses, reducing the time needed to produce and display the results

Who This Book Is For

If you are a GIS student or professional who needs an understanding of how to use ArcPy to reduce repetitive tasks and perform analysis faster, this book is for you. It is also a valuable book for Python programmers who want to understand how to automate geospatial analyses.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es ArcPy and ArcGIS – Geospatial Analysis with Python un PDF/ePUB en línea?
Sí, puedes acceder a ArcPy and ArcGIS – Geospatial Analysis with Python de Silas Toms en formato PDF o ePUB, así como a otros libros populares de Ciencia de la computación y Servicios web y API. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2015
ISBN
9781783988679

ArcPy and ArcGIS – Geospatial Analysis with Python


Table of Contents

ArcPy and ArcGIS – Geospatial Analysis with Python
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
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction to Python for ArcGIS
Overview of Python
Python as a programming language
Interpreted language
Standard (built-in) library
The glue language
Wrapper modules
The basics of Python
Import statements
Variables
For loops
If/Elif/Else statements
While statements
Comments
Data types
Strings
Integers
Floats
Lists
Tuples
Dictionaries
Iterable data types
Other important concepts
Indentation
Functions
Keywords
Namespaces
Zero-based indexing
Important Python Modules for GIS Analysis
The ArcPy module
The Operating System (OS) module
The Python System (SYS) module
The XLRD and XLWT modules
Commonly used built-in functions
Commonly used standard library modules
Summary
2. Configuring the Python Environment
What is a Python script?
How Python executes a script
What is the Python interpreter?
Where is the Python interpreter located?
Which Python interpreter should be used?
How does the computer know where the interpreter is?
Make Python scripts executable when clicked on
Integrated Development Environments (IDEs)
IDLE
PythonWin
Aptana Studio 3
IDE summary
Python folder structure
Where modules reside
Using Python's sys module to add a module
The sys.path.append() method
Summary
3. Creating the First Python Script
Prerequisites
ModelBuilder
Creating a model and exporting to Python
Modeling the Select and Buffer tools
Adding the Intersect tool
Tallying the analysis results
Exporting the model and adjusting the script
The automatically generated script
File paths in Python
Continuing the script analysis: the ArcPy tools
The Intersect tool and string manipulation
The string manipulation method 1–string addition
The string manipulation method 2–string formatting #1
The string manipulation method 3–string formatting #2
Adjusting the Script
Adding the CSV module to the script
Accessing the data: Using a cursor
The final script
Summary
4. Complex ArcPy Scripts and Generalizing Functions
Python functions–Avoid repeating code
Technical definition of functions
A first function
Functions with parameters
Using functions to replace repetitive code
More generalization of the functions
Summary
5. ArcPy Cursors – Search, Insert, and Update
The data access module
Attribute field interactions
Update cursors
Updating the shape field
Adjusting a point location
Deleting a row using an Update Cursor
Using an Insert Cursor
Inserting a polyline geometry
Inserting a polygon geometry
Summary
6. Working with ArcPy Geometry Objects
ArcPy geometry object classes
ArcPy Point objects
ArcPy Array objects
ArcPy Polyline objects
ArcPy Polygon objects
Polygon object buffers
Other Polygon object methods
ArcPy geometry objects
ArcPy PointGeometry objects
Summary
7. Creating a Script Tool
Adding dynamic parameters to a script
Displaying script messages using arcpy.AddMessage
Adding dynamic components to the script
Creating a Script tool
Labelling and defining parameters
Adding data types
Adding the Bus Stop feature class as a parameter
Adding the Census Block feature class as a parameter
Adding the Census Block field as a parameter
Adding the output spreadsheet as a parameter
Adding the spreadsheet field names as a parameter
Adding the SQL Statement as a parameter
Adding the bus stop fields as a parameter
Inspecting the final script
Running the Script Tool
Summary
8. Introduction to ArcPy.Mapping
Using ArcPy with map documents
Inspecting and replacing layer sources
Fixing the broken links
Fixing the links of individual layers
Exporting to PDF from an MXD
Adjusting map document elements
Automated map document adjustment
The variables
The map document object and the text elements
The layer objects
Replacing the data sources
Adjusting layer visibility
Generating a buffer from the bus stops feature class
Intersecting the bus stop buffer and census blocks
Populating the selected bus stop and buffer feature classes
Updating the text elements
Exporting the adjusted map to PDF
Running the script in the Python Window
Summary
9. More ArcPy.Mapping Techniques
Using arcpy.mapping to control Layer objects
Layer object methods and properties
Definition queries
Controlling the data frame window extent and scale
Adding a Layer object
Exporting the maps
Summary
10. Advanced Geometry Object Methods
Creating a Python module
The __init__.py file
Adding advanced analysis components
Advanced Polygon object methods
Generating random points to represent population
Using the functions within a script
Creating an XLS using XLWT
Summary
11. Network Analyst and Spatial Analyst with ArcPy
The Network Analyst extension
Using Network Analyst
Creating a Feature Dataset
Importing the datasets
Creating the Network Dataset
Accessing the Network Dataset using ArcPy
Breaking down the script
The Network Analyst module
Accessing the Spatial Analyst Extension
Adding elevation to the bus stops
Using Map Algebra to generate elevation in feet
Adding in the bus stops and getting elevation values
The final result
Summary
12. The End of the Beginning
Getting field information from feature classes
Accessing the ListFields' properties
List comprehensions
Creating the field information functions
Querying feature class information
Generating File Geodatabases and feature classes
Generating a feature class
Setting up the script tool parameters
Environmental settings
Resolution and tolerance settings
Summary
Index

ArcP...

Índice