GIS and R

Plankton Data from the Plum Island Estuary

Date Site Latitude Longitude Distance SampleName SubsampleName BottleName SampleType Volume Temp Salinity TotalChlA DiatomsandChrysophytes Cryptophytes Chlorophytes Dinoflagellates Euglenophytes Prasinophytes Haptophytes Prymnesiophytes Cyanobacteria Comments
2003-04-16 EST-SO-Bend-Ocean 42.69 -70.75 0.0 WS-1-331 CT-1-331 Ocean Wholewater 200 5.1 31.9 6.08 5.90 0.12 0.05 0.00 0.00 0.01 0.00 0 0.00 NA
2003-04-16 EST-SO-Bend-IBYC 42.71 -70.79 2.7 WS-2-332 CT-2-332 IBYC Wholewater 200 5.3 31.0 7.08 6.65 0.15 0.07 0.00 0.00 0.21 0.00 0 0.00 NA
2003-04-16 EST-SO-Bend-Nelson 42.75 -70.82 8.5 WS-3-333 CT-3-333 Nelson Wholewater 200 10.4 15.3 8.42 7.08 0.32 0.34 0.06 0.44 0.18 0.00 0 0.00 NA
2003-04-16 EST-PR-Bend-24 42.76 -70.84 11.0 WS-4-334 CT-4-334 24 Wholewater 300 11.1 5.5 7.01 5.37 0.39 0.28 0.11 0.63 0.17 0.01 0 0.04 NA
2003-04-16 EST-PR-Bend-22 42.76 -70.86 12.5 WS-5-335 CT-5-335 22 Wholewater 200 11.1 1.2 4.23 2.59 0.30 0.44 0.08 0.68 0.07 0.01 0 0.05 NA
2003-04-16 EST-PR-Bend-20 42.75 -70.88 14.5 WS-6-336 CT-6-336 20 Wholewater 160 11.5 0.4 1.67 0.74 0.09 0.50 0.00 0.33 0.00 0.00 0 0.01 NA

You’re starting to see something spatial…

Often within Relationships is a Pattern

What do you learn from this that is new?

Context!

What do you learn from this that is new?

What does this tell you that a bar plot would not?

Objectives

  1. What is spatial data and how is it unique/new?
  2. What is vector data?
  3. What is raster data?
  4. What is a projection?

Types of Spatial Data

Points are Coordinates

Properties of Coordinates

  • An x and y value
  • A Projection
  • An extent (minimum and maximum)
  • Additional Information

Projections and Coordinate Reference Systems

Extent

Spatial extent image

Additional Information in Points!

Lines Can Also Contain Information

As can Polygons

Objectives

  1. What is spatial data and how is it unique/new?
  2. What is vector data?
  3. What is raster data?
  4. What is a projection?

Many Ways of Representing the Same Data

Vector Data

{width = “75%”}

More Complex Vector Data

{width = “85%”}

Points

Lines (Paths)

One Polygon

Two Polygons

Many Polygons

Many Polygons

This is just vector data

Exercise: Identify these Vector Types

Exercise: Identify these Vector Types

Objectives

  1. What is spatial data and how is it unique/new?
  2. What is vector data?
  3. What is raster data?
  4. What is a projection?

Rasters

Rasters versus Vector Files

Rasters versus Vector Files

Raster Stacks/Bricks

Multi-band Raster Data = RGB image!

RGB multi-band raster image

Individual Bands

Composite Image

With rasters, we have to think of Resolution

Resolution image

Resolution v. Extent (scale)

resolution_v_scale

Why Rasters Versus Vector Formats

Filesize: Advantage Vector (smaller!)

Depth of Detail: Advantage Raster

Ease of Use in Analysis: Advantage Raster

Ease of Reprojection/Scaling: Advantage Vector

Ease of Creation: Advantage Raster

Objectives

  1. What is spatial data and how is it unique/new?
  2. What is vector data?
  3. What is raster data?
  4. What is a projection?

Projections and Coordinate Reference Systems

Projections and Coordinate Reference Systems

Components of a CRS

CRS information has three components:

  • Datum: A model of the shape of the earth.
  • Projection: A mathematical transformation of the angular measurements on a round earth to a flat surface (i.e. paper or a computer screen).

  • Additional Parameters: e.g., center of the map.

A datum is the choice of fruit to use

fruits

Image source

A projection is how you peel your orange and then flatten the peel

Image source

A PROJ4 string includes the following

  • proj=: the projection of the data
  • zone=: the zone of the data (this is specific to the UTM projection)
  • datum=: the datum use
  • units=: the units for the coordinates of the data
  • ellps=: the ellipsoid (how the earth’s roundness is calculated) for the data

UTM Zones

The UTM zones across the continental United States.

You can do a lot with those parameters

See Jason Davies’s Map Projection Transitions - https://www.jasondavies.com/maps/transition/

Exercise: Reading a PROJ4 String

Here is a PROJ4 string for one of the datasets we will use in this workshop:

+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
+ellps=WGS84 +towgs84=0,0,0

  • What projection, zone, datum, and ellipsoid are used for this data?
  • What are the units of the data?
  • Using the map above, what part of the United States was this data collected from?

Need help choosing a projection

See http://projectionwizard.org/

Additional Resources for Learning

  • Geocomputation with R by Lovelace et al. 
    • Great online book covering materials here in depth

  • Spatial Data Science by Edzer Pebsma and Roger Bivand
    • Online book in progress by authors of many R spatial packages
    • Covers emerging packages, such as stars for spatio-temporal rasters