Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and...

48
1 Setting Up Your Geospatial Python Environment Installing shapely, matplotlib, and descartes

Transcript of Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and...

Page 1: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

1 Setting Up Your Geospatial

Python Environment

Installing shapely, matplotlib, and descartes

Page 2: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

2

Installing SciPy, PySAL, and IPython

Page 3: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

2 Working with Projections

Introduction

Illustration 1: Geographic Coordinate System (http://kartoweb.itc.nl/geometrics/coordinate%20systems/coordsys.html)

Page 4: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

4

Illustration 2: Projected Coordinate System UTM (http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#mediaviewer/File:Utm-zones.jpg)

Page 5: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Listing the projection(s) from a WMS server

Page 6: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

6

3 Moving Spatial Data from One

Format to Another

Introduction

A Michael Diener drawing

Page 7: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Converting a Shapefile to a PostGIS table using ogr2ogr

Converting an OpenStreetMap (OSM) XML to a Shapefile

Page 8: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

8

Converting a Shapefile (vector) to a GeoTiff (raster)

Page 9: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

4 Working with PostGIS

Executing a PostGIS ST_Buffer analysis query and exporting it to GeoJSON

Page 10: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

10

Finding out whether a point is inside a polygon.

Splitting LineStrings at intersections using ST_Node

Page 11: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting
Page 12: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

12

Conducting a complex spatial analysis query using ST_Distance()

Page 13: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

5 Vector Analysis

Introduction

Page 14: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

14

Clipping LineStrings to an area of interest

Page 15: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Splitting polygons with lines

Page 16: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

16

Finding the location of a point on a line using linear referencing

Page 17: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Snapping a point to the nearest line

Page 18: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

18

Calculating 3D ground distance and total elevation gain

Page 19: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Data source: http://www.mapcycle.com.au/LeTour2014/#

Page 20: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

20

6 Overlay Analysis

Introduction

Page 21: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Punching holes in polygons with a symmetric difference operation

Page 22: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

22

Union polygons without merging

Page 23: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Union polygons with merging (dissolving)

Page 24: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

24

Performing an identity function (difference + intersection)

Page 25: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting
Page 26: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

26

7 Raster Analysis

Loading a DEM USGS ACSII CDED into PostGIS

Page 27: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting
Page 28: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

28

Creating a hillshade raster from your DEM with ogr

Page 29: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Generating slope and aspect images from your DEM

Page 30: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

30

Page 31: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Merging rasters to generate a color relief map

Page 32: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

32

8 Network Routing Analysis

Introduction

Page 33: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Finding the Dijkstra shortest path with pgRouting

Page 34: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

34

Finding the Dijkstra shortest path with NetworkX in pure Python

Generating evacuation polygons based on an indoor shortest path

Page 35: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Creating centerlines from polygons

Page 36: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

36

Building an indoor routing system in 3D

Page 37: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

9 Topology Checking and Data

Validation

Introduction

Page 38: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

38

Creating a rule – only one point inside a polygon

Page 39: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

A point must be on the starting and ending nodes of a line only

LineStrings must not overlap

Page 40: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

40

A LineString must not have Dangles

A polygon centroid must be within a specific distance of a line

Page 41: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

10 Visualizing Your Analysis

Generating a leaflet web map with Folium

Page 42: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

42

Setting up TileStache to serve tiles

Visualizing DEM data with Three.js

Page 43: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

Draping an orthophoto over a DEM

Page 44: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

44

11 Web Analysis with GeoDjango

Creating an indoor web routing service

Page 45: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting
Page 46: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

46

Visualizing an indoor routing service

Creating an indoor route-type service

Page 47: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting
Page 48: Setting Up Your Geospatial Python EnvironmentPython Environment Installing shapely, matplotlib, and descartes . 2 ... Converting a Shapefile to a PostGIS table using ogr2ogr Converting

48

Creating an indoor route from room to room