Presentation is loading. Please wait.

Presentation is loading. Please wait.

Maps 2 EPID 799C Fall 2017 To code along today:

Similar presentations


Presentation on theme: "Maps 2 EPID 799C Fall 2017 To code along today:"— Presentation transcript:

1 Maps 2 EPID 799C Fall 2017 To code along today:
Have a county dataframe with FIPS Download Install packages galore: sp, rgdal, rgeos, tmap,

2 Today: Maps in R Quick Review Getting spatial data Read / write Merge
Vis packages Data structures (sp/sf) Basic spatial operations Example map projects

3 Review from last time Types: Point, Line, Poly, Raster
Shapefile structure QGIS Basics

4 Getting spatial data Tiger Files: data/data/tiger-line.html NC One Map /home.page Geocode your own

5 Read/write ReadOGR writeOGR

6 Merge Exactly the same as spatial! (Thanks, overloading)
new_df = merge(df1, df2) # by=… and all.x/all.y= parameters Important! 1. Do not merge the data by itself. I have done this. 2. Also: joining data can be a pain

7 Viz Packages base::plot() sp::spplot() ggplot tmap

8 Side note: There’s a new structure in town!
Simple features (sf) spec – just a dataframe! The spatial information is stored as another “variable’ Not quite as efficient in some ways, but easier to work with. Can eventually overload dplyr functions. See cran page and many vignettes

9 Basic Spatial Operations
spTransform() , cheat sheet, spatial reference list gCentroid() gRelates() DE-9IM matrix gTouches() ^simple version of above aggregate() (spatial) gBuffer() over() and %over%  workhorse. (SE example here) gDist() spSample … and many more

10 Let’s Try! Prepare your county tbl

11 Map Project Examples Title VI complaint Flood plain mapping
Alcohol exposure index Linking police killing Police traffic stops / police


Download ppt "Maps 2 EPID 799C Fall 2017 To code along today:"

Similar presentations


Ads by Google