Outline

 

  1. Spatial Analysis
    1. spatial queries
    2. measurement
  2. Geoprocessing
    1. joining datasets
    2. Modifiable Areal Unit Problem

Spatial Analysis


 

Definition: spatial analysis

  • any method that uses data on objects’ locations and attributes

 

Types

  • queries
  • measurements
  • transformations
  • spatial joins
  • descriptive summaries
  • hypothesis tests


For example, this

Spatial Queries


 

Spatial Queries

  • simplest type of spatial analysis
  • focus on descriptive information
  • requires no changes to dataset

 

Examples

  • feature identification
    (“which county is this?”)
  • feature selection
    (“which counties are located in the Midwest?”)
  • selection by attributes
    (“which are most populous?”)
  • selection by location
    (“which are closest to the Canadian border?”)


Example of a spatial query


 

In QGIS, you can do a simple query by clicking the Identify Features button


 

… and clicking on a polygon (or point, line, grid cell)
This polygon represents the Williamsburg, Brooklyn community district


 

What if we wanted to select all districts in a borough?

  • we can do so through the Select Features by Expression tool
    (Edit menu \(\to\) Select submenu \(\to\) Select Features by Expression...)
  • here we are selecting all districts with NYC_Pop_Borough \(=\) 'Manhattan'

 

Here are the features we just selected.


 

Clear the selection by pressing Deselect Features from All Layers button

Measurement


 

Measurement

  • computation of statistics, based on the (relative) locations of features

 

Examples

  • distance
    (“how far is each county from the nearest Army base?”)
  • length
    (“how many miles of paved roads are in each county?”)
  • area
    (“how large is the jurisdiction for each police precinct?”)
  • perimeter
    (“how much coastline?”)


Distance between point \(a\) and \(...\)


 

Measures of Length

 

  1. Euclidean distance (2-dimensions)

    • straight-line distance between two points on Cartesian plane
    • from Pythagorean Theorem:
      \(d={\sqrt {(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}}}\)


Oldie, but goodie


 

 

  1. Great Circle distance

    • shortest distance between two points on a sphere
    • straight lines are replaced by curves (geodesics)
    • proportional to central angle


Circles are great


 

  1. Rhumb distance
  • arc of constant bearing
  • appears as straight line on Mercator projection


Shortest distance \(\neq\) straight line


 

In QGIS, many of these capabilities are embedded in the Processing Toolbox


 

For example, here is where you find the tool to create a distance matrix.


 

… some basic geometry measurements are also in the Field Calculator


 

Measures of Length

  • measurements depend on map projection, distance type
  • true length of curve \(>\) length of line or perimeter of polygon
  • estimated length & area on 2D projection (usually) \(<\) true length and area on 3D surface


Why projections matter

Geoprocessing

Transformations


 

Transformations

  • creation of new spatial objects, based on locations, shapes and attributes of existing objects

 

Examples

  1. Point-in-polygon
    (“how many crimes in each police precinct?”)

    • input: points \(+\) polygons
    • output: polygons, with new attribute (e.g. ncrimes)


Point-in-polygon


  1. Line-in-polygon
    (“how many miles of paved road in each district?”)

    • input: polylines \(+\) polygons
    • output: polygons, with new attribute (e.g. pvdroadlength)


Line-in-polygon


  1. Buffers
    (“which areas are within 5 miles of toxic waste site?”)

    • input: points \(+\) buffer distance
      or lines \(+\) buffer distance
      or polygons \(+\) buffer distance
    • output: polygons


Buffers


 

  1. Kernel density
    (“where are crime hotspots?”)

    • input: points
    • output: raster, where cell values are estimated local density of points


Kernel density


 

Point-in-polygon transformation

  • whether a given point lies inside/outside of a polygon

Examples

  1. Generalization

    • calculate number of points in each polygon
    • can be broken down by type of point (e.g. violent vs. non-violence crimes)
  2. Assignment

    • assign attributes of polygon to overlapping points
      (“in which precinct did a particular crime occur?”)


Generalization example


 

Joining Datasets

  1. Joining by attribute

    • add data in tabular format (e.g. .dbf, .xls, .csv) to the attributes of a geographic layer
      (e.g., polygon, line, or point)
    • requires an attribute/field common to both tables (“key”)


Join-by-attribute example


 

  1. Joining by location
  • add data from attributes of one geographic layer, to the attributes of another geographic layer
  • join based on relative location, rather than common values in attribute table


Join-by-location example

Modifiable Areal Unit Problem


 

 

 

Modifiable Areal Unit Problem

  • source of statistical bias
  • occurs when point-based measures (e.g. events, people) are aggregated into zonal units (e.g. districts, countries)
  • number, size, shape, precision of zonal units affect results
  • (often) no objective criteria for selecting units
  • different boundaries \(\to\) different distributions


MAUP


 

 

 

Example

  • legislative redistricting is a Modifiable Areal Unit Problem


Which map is best?