Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Nov 4, 2016
1 parent 3faf7e0 commit 6bce1e7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions 19-Spatial-Analysis-and-Cartography/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
### Overview:

Today we'll learn about spatial analysis, data projection, and mapping with Python.
We'll use [geopandas](http://geopandas.org/user.html), which spatializes pandas dataframes, and
matplotlib's [basemap](http://matplotlib.org/basemap/) toolkit.
We'll use [geopandas](http://geopandas.org/), which spatializes pandas dataframes,
matplotlib's [basemap](http://matplotlib.org/basemap/) toolkit, and [OSMnx](http://geoffboeing.com/2016/11/osmnx-python-street-networks/).

##### Some terminology:
- **geoid**: (that's *gee-oid*) the surface of the earth's gravity field, which approximates mean sea level
Expand All @@ -15,7 +15,7 @@ matplotlib's [basemap](http://matplotlib.org/basemap/) toolkit.
- The latitude and longitude coordinates of some point differ slightly based on the datum. GPS uses WGS84.
- **coordinate reference system** (CRS) or spatial reference system (SRS): a series of parameters that [define](http://spatialreference.org/) the coordinate system and spatial extent (aka, domain) of some dataset.
- **geographic coordinate system** (GCS): specifies a datum, spheroid, units of measure (such as meters), and a prime meridian
- **projected coordinate system** or map projection: projects a map of the Earth's 3-D spherical surface onto a flat surface that can be measured in units like meters. Here's a [list of projections](http://www.remotesensing.org/geotiff/proj_list/).
- **projected coordinate system** or map projection: projects a map of the Earth's 3-D spherical surface onto a flat surface that can be measured in units like meters. Here's a [list of projections](https://en.wikipedia.org/wiki/List_of_map_projections).
- **eastings** and **northings**: the x and y coordinates of a projected map, usually measured in meters
- **false origin**: the 0,0 origin point from which eastings and northings are measured on the map, usually the lower left corner rather than the center
- **PROJ.4**: a library to convert/project spatial data with consistent CRS [parameter names](https://github.com/OSGeo/proj.4/wiki/GenParms)
Expand All @@ -33,15 +33,15 @@ matplotlib's [basemap](http://matplotlib.org/basemap/) toolkit.
- offsets to add to all your eastings and northings - usually used to make all the coordinates on the map positive numbers by starting 0,0 at the lower left corner rather than the center of the map (see false origin, above)

##### Common projection types:
- *equal area* projections: maintain area at the expense of shape, distance, and direction - such as the [Albers Equal Area](http://www.remotesensing.org/geotiff/proj_list/albers_equal_area_conic.html) projection
- *conformal* projections: maintain shapes at the expense of area, distance, and direction - such as the [Lambert Conformal Conic](http://www.remotesensing.org/geotiff/proj_list/lambert_conic_conformal_2sp.html) projection
- *equal area* projections: maintain area at the expense of shape, distance, and direction - such as the [Albers Equal Area](https://en.wikipedia.org/wiki/Albers_projection) projection
- *conformal* projections: maintain shapes at the expense of area, distance, and direction - such as the [Lambert Conformal Conic](https://en.wikipedia.org/wiki/Lambert_conformal_conic_projection) projection
- *equidistant* projections: preserve distance from one point or along all meridians and parallels
- *azimuthal* projections: maintain direction from one point to all other points - such as an [orthographic](http://www.remotesensing.org/geotiff/proj_list/orthographic.html) projection
- others compromise to minimize overall distortion or aim for aesthetic value - such as the [Robinson](https://upload.wikimedia.org/wikipedia/commons/9/96/Robinson_projection_SW.jpg) projection
- *azimuthal* projections: maintain direction from one point to all other points - such as an [orthographic](https://en.wikipedia.org/wiki/Orthographic_projection_in_cartography) projection
- others compromise to minimize overall distortion or aim for aesthetic value - such as the [Robinson](https://en.wikipedia.org/wiki/Robinson_projection) projection

### Readings:

Look over the user guides for [geopandas](http://geopandas.org/user.html) and [basemap](http://matplotlib.org/basemap/) to get a sense of what they do and how they work, and read
Look over the user guides for [geopandas](http://geopandas.org/) and [basemap](http://matplotlib.org/basemap/) to get a sense of what they do and how they work, and read
these overviews of the foundations of GIS:

- http://www.icsm.gov.au/mapping/overview.html
Expand All @@ -60,18 +60,19 @@ at a command prompt run "conda info" then look at the platform and python versio
2. matplotlib's basemap add-on toolkit:
1. mac or linux:
1. First, conda install pillow
2. Then install basemap from source. Instructions [here](http://matplotlib.org/basemap/users/installing.html#installation) and file [here](http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz/download) If you've never seen tar.gz files before, think of them as doubly-zipped files. First you unzip the .gz and you’ll get a folder with a .tar file inside. Then you unzip the .tar file and you'll get the basemap-1.0.7 folder that the instructions refer to generically as basemap-x.y.z.
2. Then conda install basemap. If it fails, install basemap from source. Instructions [here](http://matplotlib.org/basemap/users/installing.html#installation) and file [here](http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz/download) If you've never seen tar.gz files before, think of them as doubly-zipped files. First you unzip the .gz and you’ll get a folder with a .tar file inside. Then you unzip the .tar file and you'll get the basemap-1.0.7 folder that the instructions refer to generically as basemap-x.y.z.
2. windows:
1. First, conda install pillow
2. Then install basemap using the windows installer – choose the one for your python version (such as 2.7) and architecture (32 or 64 bit): http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/ (Links to an external site.) For example I downloaded and ran the file "basemap-1.0.7.win-amd64-py2.7.exe" because I have 64 bit python 2.7.
2. Then conda install basemap. If it fails, install basemap from Gohlke's Python wheel for basemap. If that fails, use the windows installer – choose the one for your python version (such as 2.7) and architecture (32 or 64 bit): http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.7/ (Links to an external site.) For example I downloaded and ran the file "basemap-1.0.7.win-amd64-py2.7.exe" because I have 64 bit python 2.7.

### Class Session:

Run through the IPython notebook.

### More Resources:

If you're interested in more fine-grained control over plotting your basemap, you can project a shapefile and convert each piece of geometry inside it into a patch for matplotlib to plot (individually customizable). I describe this process in an old blog post I wrote: http://geoffboeing.com/2014/09/visualizing-summer-travels-part-6-projecting-spatial-data-python/
If you're interested in more fine-grained control over plotting your basemap, you can project a shapefile and convert each piece of geometry inside
it into a patch for matplotlib to plot (individually customizable). I describe this in this notebook: [spatial-joins-plotting.ipynb](spatial-joins-plotting.ipynb)

### Exercise:

Expand Down

0 comments on commit 6bce1e7

Please sign in to comment.