logo资料库

Geoprocessing with Python 无水印pdf.pdf

第1页 / 共362页
第2页 / 共362页
第3页 / 共362页
第4页 / 共362页
第5页 / 共362页
第6页 / 共362页
第7页 / 共362页
第8页 / 共362页
资料共362页,剩余部分请下载后查看
Geoprocessing with Python
brief contents
contents
preface
acknowledgments
about this book
Who should read this book
How this book is organized
About the code
Author Online
Other online resources
about the author
about the cover illustration
1 Introduction
1.1 Why use Python and open source?
1.2 Types of spatial data
1.3 What is geoprocessing?
1.4 Exploring your data
1.5 Summary
2 Python basics
2.1 Writing and executing code
2.2 Basic structure of a script
2.3 Variables
2.4 Data types
2.4.1 Booleans
2.4.2 Numeric types
2.4.3 Strings
2.4.4 Lists and tuples
2.4.5 Sets
2.4.6 Dictionaries
2.5 Control flow
2.5.1 If statements
2.5.2 While statements
2.5.3 For statements
2.5.4 break, continue, and else
2.6 Functions
2.7 Classes
2.8 Summary
3 Reading and writing vector data
3.1 Introduction to vector data
3.2 Introduction to OGR
3.3 Reading vector data
3.3.1 Accessing specific features
3.3.2 Viewing your data
3.4 Getting metadata about the data
3.5 Writing vector data
3.5.1 Creating new data sources
3.5.2 Creating new fields
3.6 Updating existing data
3.6.1 Changing the layer definition
3.6.2 Adding, updating, and deleting features
3.7 Summary
4 Working with different vector file formats
4.1 Vector file formats
4.1.1 File-based formats such as shapefiles and geoJSON
4.1.2 Multi-user database formats such as PostGIS
4.2 Working with more data formats
4.2.1 SpatiaLite
4.2.2 PostGIS
4.2.3 Folders as data sources (shapefiles and CSV)
4.2.4 Esri file geodatabases
4.2.5 Web feature services
4.3 Testing format capabilities
4.4 Summary
5 Filtering data with OGR
5.1 Attribute filters
5.2 Spatial filters
5.3 Using SQL to create temporary layers
5.4 Taking advantage of filters
5.5 Summary
6 Manipulating geometries with OGR
6.1 Introduction to geometries
6.2 Working with points
6.2.1 Creating and editing single points
6.2.2 Creating and editing multipoints: multiple points as one geometry
6.3 Working with lines
6.3.1 Creating and editing single lines
6.3.2 Creating and editing multilines: multiple lines as one geometry
6.4 Working with polygons
6.4.1 Creating and editing single polygons
6.4.2 Creating and editing multipolygons: multiple polygons as one geometry
6.4.3 Creating and editing polygons with holes: donuts
6.5 Summary
7 Vector analysis with OGR
7.1 Overlay tools: what’s on top of what?
7.2 Proximity tools: how far apart are things?
7.3 Example: locating areas suitable for wind farms
7.4 Example: animal tracking data
7.5 Summary
8 Using spatial reference systems
8.1 Introduction to spatial reference systems
8.2 Using spatial references with OSR
8.2.1 Spatial reference objects
8.2.2 Creating spatial reference objects
8.2.3 Assigning an SRS to data
8.2.4 Reprojecting geometries
8.2.5 Reprojecting an entire layer
8.3 Using spatial references with pyproj
8.3.1 Transforming coordinates between spatial reference systems
8.3.2 Great-circle calculations
8.4 Summary
9 Reading and writing raster data
9.1 Introduction to raster data
9.2 Introduction to GDAL
9.3 Reading partial datasets
9.3.1 Using real-world coordinates
9.3.2 Resampling data
9.4 Byte sequences
9.5 Subdatasets
9.6 Web map services
9.7 Summary
10 Working with raster data
10.1 Ground control points
10.2 Converting pixel coordinates to another image
10.3 Color tables
10.3.1 Transparency
10.4 Histograms
10.5 Attribute tables
10.6 Virtual raster format
10.6.1 Subsetting
10.6.2 Creating troublesome formats
10.6.3 Reprojecting images
10.7 Callback functions
10.8 Exceptions and error handlers
10.9 Summary
11 Map algebra with NumPy and SciPy
11.1 Introduction to NumPy
11.2 Map algebra
11.2.1 Local analyses
11.2.2 Focal analyses
11.2.3 Zonal analyses
11.2.4 Global analyses
11.3 Resampling data
11.4 Summary
12 Map classification
12.1 Unsupervised classification
12.2 Supervised classification
12.2.1 Accuracy assessments
12.3 Summary
13 Visualizing data
13.1 Matplotlib
13.1.1 Plotting vector data
13.1.2 Plotting raster data
13.1.3 Plotting 3D data
13.2 Mapnik
13.2.1 Drawing vector data
13.2.2 Storing information as XML
13.2.3 Drawing raster data
13.3 Summary
appendix A Installation
A.1 Anaconda
A.2 Nonbundled installations
A.2.1 Linux
A.2.2 Mac OS X
A.2.3 Windows
A.3 Environment variables
A.4 Source code and data
A.5 Development environments
appendix B References
Data used in figures
Chapter 1
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Data references
index
Symbols
Numerics
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Geoprocessing with Python-back
Chris Garrard M A N N I N G
Geoprocessing with Python
ii
Geoprocessing with Python CHRIS GARRARD M A N N I N G SHELTER ISLAND
iv For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com ©2016 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without elemental chlorine. Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Development editor: Jennifer Stout Technical development editor: Karsten Strøbæk Copyeditor: Katie Petito Proofreader: Katie Tennant Technical proofreader: Rizwan Bilbul Typesetter: Marija Tudor Cover designer: Marija Tudor ISBN: 9781617292149 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – EBM – 21 20 19 18 17 16
brief contents Introduction 1 1 ■ 2 ■ Python basics 15 3 ■ Reading and writing vector data 35 4 ■ Working with different vector file formats 67 5 ■ Filtering data with OGR 88 6 ■ Manipulating geometries with OGR 105 7 ■ Vector analysis with OGR 129 8 ■ Using spatial reference systems 153 9 ■ Reading and writing raster data 173 10 ■ Working with raster data 208 11 ■ Map algebra with NumPy and SciPy 237 12 ■ Map classification 276 13 ■ Visualizing data 287 v
vi BRIEF CONTENTS
contents xi preface acknowledgments about this book about the author about the cover illustration xviii xvii xiii xiv 1 Introduction 1 1.1 Why use Python and open source? 2 1.2 Types of spatial data 3 1.3 What is geoprocessing? 7 1.4 Exploring your data 10 1.5 Summary 14 2 Python basics 15 2.1 Writing and executing code 16 2.2 Basic structure of a script 17 2.3 Variables 18 2.4 Data types 20 Booleans 20 ■ Numeric types 20 ■ Strings 22 Lists and tuples 24 ■ Sets 26 ■ Dictionaries 26 2.5 Control flow 27 If statements 27 ■ While statements 29 ■ For statements 29 ■ break, continue, and else 30 Functions 31 2.6 2.7 Classes 32 2.8 Summary 34 vii
分享到:
收藏