Introduction

Time: 30 minutes

Purpose: In this lesson we will introduce some of the key concepts associated with spatial data including:

We will also define raster vs. vector data structures.

Background: Often we need to use spatial data in our analysis - that is data that correspond to some x,y (and z) location on the Earth. however, not all spatial data are created the same. understanding the basic foundations of working with spatial data will save you a lot of time when it comes to processing the data in tools like R, QGIS and python!

Learning outcomes

At the end of this 30 minute overview you will be able to:

  1. Explain the difference between the raster vs vector data structures.
  2. Define spatial extent, resolution, coordinate reference system.
  3. List the 3 vector data structures (point, line, polygon).
  4. List 2-3 R packages that can be used to work with spatial data.

Getting started with R

the R / Python learning curve

the R / Python learning curve

Why R for GIS - the power of automation

It may be a bit of extra effort at the beginning to learn a tool like R. However, the payoff is large once you learn the basic skills to support task automation.

Geeks and automation

Geeks and automation

Specific to spatial data, R allows you to:

In this lesson we are going to learn the basics of working with spatial data in R. Some of you may think this is the boring stuff - however understanding these concepts will allow you to do just about anything that you want with spatial data in R!

About vector data

Intro to vector data - EarthDataScience.org

Attributes of vector data

Vector data types - points, lines and polygons

Vector data types - points, lines and polygons

Vector data formats

There are many different spatial vector data formats. Let’s list a few:

Vector data spatial extent

The spatial extent of a vector dataset is determined by the min and max x,y location of ALL OF THE SPATIAL OBJECTS stored in the dataset.

NOTE: the spatial extent of an individual object can also be quantified!

About vector data extent

About vector data extent

Vector data attributes

Vector data often has associated attribute tables. When in a shapefile format, these look like excel spreadsheets where each object has an associated set of attributes.

Attribute tables

Attribute tables

in a geojson structure this may look like this:

[ {
  "station_name" : "SOUTH PLATTE RIVER AT COOPER BRIDGE NEAR BALZAC",
  "amount" : "262.00",
  "flag" : "na",
  "station_status" : "Gage temporarily anavailable",
  "county" : "MORGAN",
  "wd" : "1",
  "dwr_abbrev" : "PLABALCO",
  "data_source" : "Co. Division of Water Resources",
  "http_linkage" : {
    "url" : "http://www.dwr.state.co.us/SurfaceWater/data/detail_graph.aspx?ID=PLABALCO&MTYPE=DISCHRG"
  },
  "div" : "1",
  "date_time" : "2017-02-15T09:00:00",
  "stage" : "1.86",
  "usgs_station_id" : "06759910",
  "variable" : "DISCHRG",
  "location" : {
    "latitude" : "40.357498",
    "needs_recoding" : false,
    "longitude" : "-103.528053"
  },
  "station_type" : "Stream"
}
...
]

Coordinate reference systems - how spatial data line up

The human head projected

The human head projected

Components of a CRS

The Components of a CRS

The coordinate reference system is made up of several key components:

About raster data

About raster data:

Open raster data in R - earthdatascience.org website

About raster data

About raster data

Raster resolution

  • The size of each pixel is referred to as resolution
  • If pixels are smaller (represent a smaller area on the earth, they are considered HIGHER resolution) - in the example of an image, this makes the image look more ‘crisp’
  • if you have fewer pixels within a particular spatial extent, the resolution is LOWER
  • if you have more pixels within a particular spatial extent, the resolution is HIGHER
Raster resolution

Raster resolution

Raster pixel resolution

Raster pixel resolution

Raster spatial extent

The spatial extent of a raster refers to the area on the earth’s surface that the raster covers.

Raster spatial extent

Raster spatial extent

Note that the raster spatial extent relates directly to the spatial resolution.

CHALLENGE questions

  1. If you have more pixels over the same spatial extent - will the image look sharper (more clear) or more blurry?
  2. If you have fewer pixels over the same spatial extent…
Raster pixel resolution

Raster pixel resolution