Lab 8 (2013) Spatial Statistics I
File nameFile typeSize
NWAlamedaCtyBGs2010.zipZip archive data1015.44 kBInfo
onions-and-diamonds.zipZip archive data15.42 kBInfo

Create a Word Document…

… into which you can put your work as you go along. Be sure to include enough narrative that a reader will know what you did.

Get Some Data

  1. Download, etc. the Onions-and-Diamonds folder.
  2. Add GRID, DIAMONDS, and ONIONS to a map.
  3. Use VECTOR>ANALYSIS TOOLS>POINTS IN POLYGON to count the number of onions in each grid square into a new shape file called OCOUNT. Repeat for diamonds into a layer called DCOUNT (see Points in Polygon tutorial if this seems mysterious).
  4. Join these two layers together (either can be the base of the join). Save the result as OD_Data.
  5. Add and remove layers so that you have this new grid with count data, the onion points and the diamond points on a map.
  6. Create a print composer, align things, and export image file to import into your Word document.

Dichotomize Diamond and Onion Data

  1. Create a new field called AnyDiamonds. Use field calculator to populate it with 1 for grid squares that have more than zero diamonds.
  2. Repeat for an AnyOnions field.
  3. Create thematic maps that show grid squares with and without diamonds and/or onions. Display them side-by-side in a print composer and export/import into your word document.

Create a "Two Dimensional" or "Bivariate" Data Field

  1. Now create a new field called "Nothing, Diamonds, Onions, or Both" (N_D_O_Both). Calculate it as $AnyDiamonds + 2 \times AnyOnions.$
  2. STOP AND THINK: what four values can this field have and what do they mean?
  3. Create a categorized thematic map based on this field (in some versions you might need to go back to "Old Symbology." Select the colors so that they are easy to interpret (for example, brown = neither, red = onions, blue = diamonds, violet = both) and label the legend correctly.
  4. Print composer and save with appropriate titles/annotations.

Simple Statistics on Your Variables

  1. Use VECTOR>ANALYSIS TOOLS>SIMPLE STATISTICS to get the mean, std deviation, etc. of onion counts, diamond counts. Report these.

Export to Excel and Analyze

Export CSV and import into Excel to make a scatter plot of onion counts vs. diamond counts.
Use the tools at your disposal to fill in this table:

Some Onions No Onions Totals
Some Diamonds
No Diamonds

Calculate percentages. Do you see anything here?


  1. Create buffers of radius 600 around diamonds and around onions. Call the layers onions600, etc.
  2. Save map into Word.

Intersecting Buffers

Intersecting points and polygons

Suppose you want to label point features with the ID of the polygon they lie within.

Intersect your onions and your grid and then your diamonds and your grid. This should leave you with two point layers, each with features also labeled with their grid square location (ROWCOL).

Buffers Again

Create buffers around the layers just created. Examine attributes.

Dissolving Buffers

Dissolve the buffers just created allowing features from same grid square (same ROWCOL) to dissolve. Give the shape file a sensible name.
Examine the attributes of the result.
Use the select tool to verify that some features have multiple polygons.

Create convex hulls around diamonds based on ROWCOL (the grid square ID). Repeat for onions.

File nameFile typeSize
NWAlamedaCtyBGs2010.zipZip archive data1015.44 kBInfo
onions-and-diamonds.zipZip archive data15.42 kBInfo