Page 1
1 Setting Up Your Geospatial
Python Environment
Installing shapely, matplotlib, and descartes
Page 2
2
Installing SciPy, PySAL, and IPython
Page 3
2 Working with Projections
Introduction
Illustration 1: Geographic Coordinate System (http://kartoweb.itc.nl/geometrics/coordinate%20systems/coordsys.html)
Page 4
4
Illustration 2: Projected Coordinate System UTM (http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#mediaviewer/File:Utm-zones.jpg)
Page 5
Listing the projection(s) from a WMS server
Page 6
6
3 Moving Spatial Data from One
Format to Another
Introduction
A Michael Diener drawing
Page 7
Converting a Shapefile to a PostGIS table using ogr2ogr
Converting an OpenStreetMap (OSM) XML to a Shapefile
Page 8
8
Converting a Shapefile (vector) to a GeoTiff (raster)
Page 9
4 Working with PostGIS
Executing a PostGIS ST_Buffer analysis query and exporting it to GeoJSON
Page 10
10
Finding out whether a point is inside a polygon.
Splitting LineStrings at intersections using ST_Node
Page 12
12
Conducting a complex spatial analysis query using ST_Distance()
Page 13
5 Vector Analysis
Introduction
Page 14
14
Clipping LineStrings to an area of interest
Page 15
Splitting polygons with lines
Page 16
16
Finding the location of a point on a line using linear referencing
Page 17
Snapping a point to the nearest line
Page 18
18
Calculating 3D ground distance and total elevation gain
Page 19
Data source: http://www.mapcycle.com.au/LeTour2014/#
Page 20
20
6 Overlay Analysis
Introduction
Page 21
Punching holes in polygons with a symmetric difference operation
Page 22
22
Union polygons without merging
Page 23
Union polygons with merging (dissolving)
Page 24
24
Performing an identity function (difference + intersection)
Page 26
26
7 Raster Analysis
Loading a DEM USGS ACSII CDED into PostGIS
Page 28
28
Creating a hillshade raster from your DEM with ogr
Page 29
Generating slope and aspect images from your DEM
Page 31
Merging rasters to generate a color relief map
Page 32
32
8 Network Routing Analysis
Introduction
Page 33
Finding the Dijkstra shortest path with pgRouting
Page 34
34
Finding the Dijkstra shortest path with NetworkX in pure Python
Generating evacuation polygons based on an indoor shortest path
Page 35
Creating centerlines from polygons
Page 36
36
Building an indoor routing system in 3D
Page 37
9 Topology Checking and Data
Validation
Introduction
Page 38
38
Creating a rule – only one point inside a polygon
Page 39
A point must be on the starting and ending nodes of a line only
LineStrings must not overlap
Page 40
40
A LineString must not have Dangles
A polygon centroid must be within a specific distance of a line
Page 41
10 Visualizing Your Analysis
Generating a leaflet web map with Folium
Page 42
42
Setting up TileStache to serve tiles
Visualizing DEM data with Three.js
Page 43
Draping an orthophoto over a DEM
Page 44
44
11 Web Analysis with GeoDjango
Creating an indoor web routing service
Page 46
46
Visualizing an indoor routing service
Creating an indoor route-type service
Page 48
48
Creating an indoor route from room to room