SPATIAL MAPS
STA465: Theory and Methods for Complex Spatial Data
Instructor: Dr. Vianey Leos Barajas
WORKING WITH SPATIAL DATA STRUCTURES IN R
Well exclusively use R to work with spatial data:
There are two books we will use to learn how to work with spatial data structures and plot spatial data in R:
Geocomputation with R
Geospatial Health Data: Modeling and Visualization with R-INLA and Shiny
Spatial data structures: Beyond plotting points
Data sets will now have additional structures https://r-spatial.github.io/sf/reference/index.html
GEOCOMPUTATION WITH R
PDF of book: https://geocompr.robinlovelace.net
R PACKAGES
install.packages(sf ): a class system for geographic vector data install.packages(raster)
install.packages(spData) remotes::install_github(Nowosad/spDataLarge)
library(sp)
What about ggplot2 or base R?
For spatial data structures, we need to go beyond that We can use it in combination with sf or sp structures
VECTOR DATA
SIMPLE FEATURES (SF)
Figure from geocomputation with R
From https://r-spatial.github.io/sf/articles/sf1.html
## library(spData) plot(world)
## library(spData) world
plot(world[pop])
SPATIAL DATA
How is the data structured here?
plot(world[pop])
ASIA
R CODE:
R CODE:
RASTER DATA
RASTER DATA
Consists of a raster header and matrix whose rows and columns represent equally spaced cells (aka pixels)
Raster maps usually represent continuous phenomena such as elevation, population density or spectral data
Can represent discrete features such as soil or land-cover classes with the help of a raster data model
RASTER DATA
The cell of one raster layer can only hold a single value:
CONTINUOUS AND CATEGORICAL RASTERS
WHAT CAN WE DO?
Given a coordinate, we can: Identify elevation
Connect to land cover type
DATA STRUCTURE IN R
COORDINATE REFERENCE SYSTEM (CRS)
3D AND 2D EARTH SURFACES
From geospatial health data
GEOGRAPHIC COORDINATE SYSTEMS
A geographic coordinate system specifies locations on the Earths three-dimensional using latitude and longitude values.
PROJECTED COORDINATE SYSTEMS
Map projections are transformation of the Earths three- dimensional surface as a flat two-dimensional plane
All map projections distort the Earths surface in some fashion. Can only preserve one to two of the following:
Area
Direction
Shape
Distance properties
PROJECTION TYPES
Conic projected onto a cone along a single line of tangency or two lines of tangency
Best suited for maps of mid-latitude areas Cylindrical maps the surface onto a cylinder
Most often used for plotting the world
Planar projects data onto a flat surface touching the globe at a point or along a line of tangency
Typically used in mapping polar regions
FIGURE 6.2: Mollweide projection of the world.
FIGURE 6.3: Winkel tripel projection of the world.
PROJECTED COORDINATE SYSTEMS
Universal Transverse Mercator UTM Preserves local angles and shapes.
Divides Earth into 60 zones of 6 degrees of longitude in width
Each zone uses transverse Mercator projection to map a region of
Position on Earth given by UTM zone number, hemisphere, and easting/northing coordinates in zone (measured in meters)
Eastings are referenced from the central meridian of each zone, and northings are referenced from the equator. The easting at the central meridian of each zone is defined to have a value of 500,000 meters
BACK TO PREVIOUS DATA SET:
CRS OPTIONS
CRS
Specifies how coordinates are related to locations on Earth
CRS is either geographic or projected
In R, CRS specified using `proj4` strings that specify:
Projection Ellipsoid Datum
SELECTING AND SETTING CRS
Depending on the data set you work with, it may already have a defined CRS typically comes as a `shape` file (.shp)
What if it doesnt?
There will be choices to be made!
Dont make an assumption without thoroughly contacting people who know the data best
https://www.spatialreference.org
There are a some commonly used CRS, for example:
WGS84/4326
SETTING AND CHANGING A CRS
SETTING AND CHANGING A CRS
SETTING AND CHANGING A CRS
SETTING AND CHANGING A CRS
MANIPULATING SPATIAL DATA STRUCTURES
COMBINING/MODIFYING SPATIAL DATA STRUCTURES
You want to combine two data sets but they have different CRS
You have two data sets, one with points and one with multipolygons how do you combine them?
Overlaying multipolygons, strings, points
Computing distances, areas from spatial data structure!
Reviews
There are no reviews yet.