Preface |
|
xi | |
Acknowledgments |
|
xiii | |
About this book |
|
xiv | |
About the author |
|
xvii | |
About the cover illustration |
|
xviii | |
|
|
1 | (14) |
|
1.1 Why use Python and open source? |
|
|
2 | (1) |
|
1.2 Types of spatial data |
|
|
3 | (4) |
|
1.3 What is geoprocessing? |
|
|
7 | (3) |
|
|
10 | (4) |
|
|
14 | (1) |
|
|
15 | (20) |
|
2.1 Writing and executing code |
|
|
16 | (1) |
|
2.2 Basic structure of a script |
|
|
17 | (1) |
|
|
18 | (2) |
|
|
20 | (7) |
|
|
20 | (1) |
|
|
20 | (2) |
|
|
22 | (2) |
|
|
24 | (2) |
|
|
26 | (1) |
|
|
26 | (1) |
|
|
27 | (4) |
|
|
27 | (2) |
|
|
29 | (1) |
|
|
29 | (1) |
|
break, continue, and else |
|
|
30 | (1) |
|
|
31 | (1) |
|
|
32 | (2) |
|
|
34 | (1) |
|
3 Reading and writing vector data |
|
|
35 | (32) |
|
3.1 Introduction to vector data |
|
|
36 | (5) |
|
|
41 | (3) |
|
|
44 | (7) |
|
Accessing specific features |
|
|
47 | (2) |
|
|
49 | (2) |
|
3.4 Getting metadata about the data |
|
|
51 | (3) |
|
|
54 | (9) |
|
Creating new data sources |
|
|
59 | (2) |
|
|
61 | (2) |
|
3.6 Updating existing data |
|
|
63 | (3) |
|
Changing the layer definition |
|
|
63 | (1) |
|
Adding, updating, and deleting features |
|
|
64 | (2) |
|
|
66 | (1) |
|
4 Working with different vector file formats |
|
|
67 | (21) |
|
|
68 | (3) |
|
File-based formats such as shapefiles and geoJSON |
|
|
68 | (3) |
|
Multi-user database formats such as PostGIS |
|
|
71 | (1) |
|
4.2 Working with more data formats |
|
|
71 | (13) |
|
|
72 | (1) |
|
|
73 | (1) |
|
Folders as data sources (shapefiles and CSV) |
|
|
74 | (1) |
|
|
74 | (2) |
|
|
76 | (8) |
|
4.3 Testing format capabilities |
|
|
84 | (3) |
|
|
87 | (1) |
|
5 Filtering data with OGR |
|
|
88 | (17) |
|
|
89 | (4) |
|
|
93 | (6) |
|
5.3 Using SQL to create temporary layers |
|
|
99 | (4) |
|
5.4 Taking advantage of filters |
|
|
103 | (1) |
|
|
104 | (1) |
|
6 Manipulating geometries with OGR |
|
|
105 | (24) |
|
6.1 Introduction to geometries |
|
|
106 | (1) |
|
|
107 | (5) |
|
Creating and editing single points |
|
|
108 | (2) |
|
Creating and editing multipoints: multiple points as one geometry |
|
|
110 | (2) |
|
|
112 | (8) |
|
Creating and editing single lines |
|
|
114 | (4) |
|
Creating and editing multilines: multiple lines as one geometry |
|
|
118 | (2) |
|
6.4 Working with polygons |
|
|
120 | (8) |
|
Creating and editing single polygons |
|
|
122 | (2) |
|
Creating and editing multipolygons: multiple polygons as one geometry |
|
|
124 | (2) |
|
Creating and editing polygons with holes: donuts |
|
|
126 | (2) |
|
|
128 | (1) |
|
7 Vector analysis with OGR |
|
|
129 | (24) |
|
7.1 Overlay tools: what's on top of what? |
|
|
130 | (6) |
|
7.2 Proximity tools: how far apart are things? |
|
|
136 | (4) |
|
7.3 Example: locating areas suitable for wind farms |
|
|
140 | (4) |
|
7.4 Example: animal tracking data |
|
|
144 | (8) |
|
|
152 | (1) |
|
8 Using spatial reference systems |
|
|
153 | (20) |
|
8.1 Introduction to spatial reference systems |
|
|
154 | (5) |
|
8.2 Using spatial references with OSR |
|
|
159 | (9) |
|
Spatial reference objects |
|
|
159 | (2) |
|
Creating spatial reference objects |
|
|
161 | (2) |
|
|
163 | (1) |
|
|
164 | (3) |
|
Reprojecting an entire layer |
|
|
167 | (1) |
|
8.3 Using spatial references with pyproj |
|
|
168 | (4) |
|
Transforming coordinates between spatial reference systems |
|
|
169 | (2) |
|
Great-circle calculations |
|
|
171 | (1) |
|
|
172 | (1) |
|
9 Reading and writing raster data |
|
|
173 | (35) |
|
9.1 Introduction to raster data |
|
|
174 | (7) |
|
|
181 | (6) |
|
9.3 Reading partial datasets |
|
|
187 | (13) |
|
Using real-world coordinates |
|
|
193 | (3) |
|
|
196 | (4) |
|
|
200 | (3) |
|
|
203 | (1) |
|
|
204 | (3) |
|
|
207 | (1) |
|
10 Working with raster data |
|
|
208 | (29) |
|
10.1 Ground control points |
|
|
209 | (4) |
|
10.2 Converting pixel coordinates to another image |
|
|
213 | (2) |
|
|
215 | (3) |
|
|
217 | (1) |
|
|
218 | (3) |
|
|
221 | (2) |
|
10.6 Virtual raster format |
|
|
223 | (7) |
|
|
225 | (2) |
|
Creating troublesome formats |
|
|
227 | (1) |
|
|
228 | (2) |
|
|
230 | (2) |
|
10.8 Exceptions and error handlers |
|
|
232 | (4) |
|
|
236 | (1) |
|
11 Map algebra with NumPy and SciPy |
|
|
237 | (39) |
|
11.1 Introduction to NumPy |
|
|
238 | (4) |
|
|
242 | (25) |
|
|
243 | (4) |
|
|
247 | (11) |
|
|
258 | (5) |
|
|
263 | (4) |
|
|
267 | (8) |
|
|
275 | (1) |
|
|
276 | (11) |
|
12.1 Unsupervised classification |
|
|
278 | (2) |
|
12.2 Supervised classification |
|
|
280 | (6) |
|
|
284 | (2) |
|
|
286 | (1) |
|
|
287 | (32) |
|
|
288 | (19) |
|
|
288 | (12) |
|
|
300 | (5) |
|
|
305 | (2) |
|
|
307 | (11) |
|
|
308 | (6) |
|
Storing information as XML |
|
|
314 | (2) |
|
|
316 | (2) |
|
|
318 | (1) |
Appendix A Installation |
|
319 | (8) |
Appendix B References |
|
327 | (4) |
Index |
|
331 | |