Chapter 3. Reading and writing vector data
Listing 3.1. Printing data from the first ten features in a shapefile
Listing 3.2. Example of well-known text representation of a spatial reference system
Chapter 4. Working with different vector file formats
Listing 4.1. An example GeoJSON file with two features
Listing 4.2. Function to import layers to a file geodatabase
Chapter 6. Manipulating geometries with OGR
Listing 6.1. Function to create a point layer from a line layer
Listing 6.2. Function to create a line layer from a polygon layer
Chapter 7. Vector analysis with OGR
Listing 7.1. A flawed method for determining the number of cities near volcanoes
Listing 7.2. A better method for determining the number of cities near volcanoes
Listing 7.3. Intersecting census and wind data
Listing 7.4. Combining small polygons into large ones
Listing 7.5. Create a shapefile from a .csv file
Listing 7.6. Function to get unique values from an attribute column
Listing 7.7. Calculating distance between adjacent points
Listing 7.8. Find maximum speed from locations and elapsed time
Listing 7.9. Create convex hull polygons for each bird
Listing 7.10. Create convex hull polygons separated by geographic area
Listing 7.11. Calculate percentage of total area used in all island visits
Chapter 8. Using spatial reference systems
Chapter 9. Reading and writing raster data
Listing 9.1. Stacking individual raster bands into one image
Listing 9.2. Processing a raster by block
Listing 9.3. Extracting and saving a subset of an image
Listing 9.4. Resample an image to a smaller pixel size
Listing 9.5. Resample an image to a larger pixel size using byte sequences
Chapter 10. Working with raster data
Listing 10.1. Adding ground control points to a raster
Listing 10.2. Mosaic multiple images together
Listing 10.3. Add a color map to a raster
Listing 10.4. Add an attribute table to a raster
Listing 10.5. XML to define a VRT dataset with one band
Chapter 11. Map algebra with NumPy and SciPy
Listing 11.1. Function to save a new raster
Listing 11.2. Compute NDVI for a NAIP image
Listing 11.3. Function to get slices of any size from an array
Listing 11.4. Smooth an elevation dataset
Listing 11.5. Compute slope from DEM
Listing 11.6. Smoothing filter using SciPy
Listing 11.7. Calculate slope using SciPy
Listing 11.8. Focal analysis broken into chunks
Listing 11.9. Zonal analysis with SciPy
Listing 11.10. Proximity analysis
Listing 11.11. Function to make stepped slices
Listing 11.12. Function to get new pixel offsets in terms of old pixels
Chapter 12. Map classification
Listing 12.1. Function to stack raster bands
Listing 12.2. K-means clustering with Spectral Python
Chapter 13. Visualizing data
Listing 13.1. Plotting simple polygons
Listing 13.2. Plotting polygons
Listing 13.4. Draw world countries as patches
Listing 13.5. Function to retrieve overview data
Listing 13.6. Function to stretch and scale data
Listing 13.7. Using meshgrid to get map coordinates
Listing 13.8. Creating a simple Mapnik map
Listing 13.9. Using multiple rules in a style
Listing 13.10. Adding the roads and city outline
Listing 13.11. Create XML to describe the National Atlas hydrography layer
Listing 13.12. XML describing the National Atlas hydrography layer
3.145.14.132