1 of 18

1

Introduction to Spatial Analysis with R Workshop

Instructor: Jeff Blossom jblossom@cga.harvard.edu

2 of 18

2

Our mission: We aim to help grow and sustain spatial research and teaching across campus and across disciplines through research, data, infrastructure, and training. 

Location: CGIS Knafel basement. 1737 Cambridge St.

Contact: http://gis.harvard.edu/contactus

3 of 18

What Is Spatial Analysis

  • It is the techniques, methods, processes and manipulations for examining and revealing
    • geographic patterns in spatial data, and
    • relationships between spatial features.
  • Its results add value to geographic data, and turns data into useful information for
    • better understanding of how the world works, and
    • better decision making
  • It is location dependent
    • results change when the locations of the objects being analyzed change.
  • It is also referred to as
    • Geospatial Analysis
    • Geographic Analysis
    • GIS Analysis

4 of 18

  • Data Exploration (visual analysis)
    • Quantitative mapping – What is the total area of the rain forest?
    • Location based query – Which toxic waste sites are inside my city boundary?
    • Attribute query – What cities have a median age over 40?
  • Data Analysis
    • Proximity – What is the distance from each Mexican city to the U.S. border?
    • Overlay – How many factories are in each county?
    • Adjacency – Which land parcels border the state forest?
    • Network – What’s the driving distance from all patient addresses to the nearest doctor?
    • Geostatistical – Are the oil spill locations clustered, dispersed, or randomly distributed?

Spatial analysis types and questions

5 of 18

Common Analytical Procedure

Frame the question

Prepare the data

Choose a method

Process the data

Examine the results

Present the Results

Automation

6 of 18

The 1st law of Geography:

“I invoke the first law of geography: everything is related to everything else, but near things are

more related than distant things’’ (Tobler 1970).

Determining how near things are is important.

Proximity – a synonym for near.

6

7 of 18

Proximity Analysis

  • Also called distance analysis.
  • May involve one or multiple input data classes.
  • May produce new data, or new attribute fields.
  • Common proximity analysis

    • Buffer and Multiple Ring Buffer
    • Create Thiessen Polygons
    • Distance matrix calculation

8 of 18

8

GIS Network Analysis – Driving distance and time analysis along a road network.

9 of 18

Overlay Analysis

  • Overlay analysis produces new information based on what features are coincident in space.
  • Typical overlay analysis combines multiple data layers, and produces new attributes and spatial data.
  • Common overlay operations:
    • Clip
    • Split
    • Erase
    • Intersect
    • Spatial Join (does not produce

new spatial data)

    • Symmetrical difference
    • Union
    • Update

10 of 18

Overlay Analysis technique: �Spatial Join

  • Creates a new layer in which -
    • Fields from one layer's attribute table are (virtually) appended to another layer's attribute table
  • Based on the relative locations of the features in the two layers.
  • Does not alter the geometry of the features.

11 of 18

GIS Overlay Analysis Technique: Spatial Join

Transfers the attributes from one feature class to another feature class, based on the spatial relationships between the features in the two feature classes.

For example, we have Boston crimes geocoded to their street intersections. What neighborhood is each address in?

12 of 18

GIS Overlay Analysis Technique: Spatial Join

Transfers the attributes from one feature class to another feature class, based on the spatial relationships between the features in the two feature classes.

For example, we have Boston crimes geocoded to their street intersections. What neighborhood is each address in?

Spatial Join command from the address intersection points to the neighborhood polygons does a “point in polygon” evaluation for

each point, and transfers the attributes of the polygon over to the point.

13 of 18

GIS Overlay Analysis Technique: Spatial Join

Transfers the attributes from one feature class to another feature class, based on the spatial relationships between the features in the two feature classes.

Spatial join can also answer the question: How many intersections are in each neighborhood?

N_hood_GIS

Count_Intersections

South Boston

54

Roxbury

32

Hyde Park

35

South Dorchester

43

Back Bay

34

Spatial Join command from neighborhood polygons to the address intersection points will summarize the total number of addresses per neighborhood.

14 of 18

Adjacency analysis

Identifies neighbors.

What counties border Macon County?

15 of 18

Network analysis

  • Calculates routes between origins and destinations based on impedance (usually distance or time).
  • Destinations can be general or individualized to each origin.
  • Can add “stops” as route determination criteria.

16 of 18

Network analysis: Service area calculation����������Answers the question: What area is within a certain distance or travel time of a specific location?.

http://desktop.arcgis.com/en/arcmap/latest/extensions/network-analyst/service-area.htm

17 of 18

Geostatistical Analysis

Statistical techniques used to analyze and predict the values of spatial phenomena (like pollution, or temperature) at unsampled locations based

Images from:

https://www.sciencedirect.com/science/chapter/referencework/abs/pii/B9780124095489091636n measured sample data.

18 of 18

Let’s do some spatial analysis with R!�1. Open a web browser and go to gis.Harvard.edu�2. Scroll down to Upcoming Events, and click on the Getting Started with Spatial Analysis in R.�3. Download the Exercise 1 word document, and open. Follow the directions with your instructor within this document.