September 8, 2014
FOSS4G 2014, Portland, OR
PySAL is a cross-platform library of spatial analysis functions written in Python. It is intended to support the development of high level applications for spatial analysis with an emphasis on vector spatial data. This tutorial will provide hands-on training in a select set of PySAL modules with a particular focus on spatial data processing, spatial autocorrelation analysis and visualization.
- Previous experience with Python programming is recommended
- Participants should bring their own laptops to the workshop
- Software should be installed prior to traveling to the workshop (instructions below)
For the workshop we will require the following packages be installed
- PySAL 1.8.0
- SciPy
- Numpy
- iPython Notebook 2.1+
- folium
There are a number of ways to install PySAL and these dependencies. For the workshop, if you do not yet have the dependencies installed we suggest using one of two scientific Python distributions (below). These have the advantages of including most of the dependencies for PySAL as well as PySAL itself. Moreover, both allow for updating PySAL to the most recent release (1.8 released July 25, 2014) which is more current that what is listed in either distribution. Both of these distributions also allow for installation of our final dependency, folium.
- Install Anaconda Python Distribution Version 1.8.0
- Open a terminal (Mac or Linux) or Powershell (Windows)
pip install -U pysal
pip install -U folium
Note that the Academic version of Canopy comes with PySAL version 1.7. For this workshop we will be using PySAL 1.8. Upgrading in Canopy can be done as follows:
- Install Canopy
- Run Canopy
- From the menu select
Tools Canopy Terminal
pip install -U pysal
pip install -U folium
Once you have installed all the dependencies, you can check to confirm everything is ready to go.
For Anaconda:
-
Open a terminal (Mac or Linux) or Powershell (Windows)
-
ipython notebook
-
In the browser click
New Notebook
-
In the first cell in the notebook enter
import pysal
pysal.version
Then
<Shift-Enter>
(i.e., hit the Shift then the Enter Key) -
In the second cell in the notebook enter
import folium
Then
<Shift-Enter>
Your screen should look something like:
For Enthought Canopy:
-
Run Canopy
-
From the menu select
Tools Canopy Terminal
-
ipython notebook
-
In the browser click
New Notebook
-
In the first cell in the notebook enter
import pysal
pysal.version
Then
<Shift-Enter>
(i.e., hit the Shift then the Enter Key) -
In the second cell in the notebook enter
import folium
Then
<Shift-Enter>
Your screen should look something like:
If you run into any problems, double check that you have installed both the upgraded version of PySAL and folium (see above). If problems persist, please contact me sjsrey@gmail.com.