Presentation is loading. Please wait.

Presentation is loading. Please wait.

Learn R! GIS.

Similar presentations


Presentation on theme: "Learn R! GIS."— Presentation transcript:

1 Learn R! GIS

2 What is GIS? GIS = “Geographic Information System” Ideally In practice
Answer questions related to proximity In practice A method of job security A method of intimidation A method of making money Tools better understood than ideas behind them

3 Disclaimer: Why I don't use ArcGIS
QGIS is a free replacement with better features Faster than ArcGIS to an order of 10x ArcGIS is a pain to install/set up licenses Useless for Linux/Mac users ArcGIS expense limits use: government/industry/universities ESRI spends $$$ promoting and “locking in” ArcGIS users Point-and-click is nice for making maps, but “toolbox” style analysis is painful for reproducible/dynamic work

4 ESRI's Legacy: “Shapefile” Format
Most common GIS data format (90's relic) Information stored across many files .shp geometry feature information (i.e. counties) .shx index of features .dbf attributes of each geometry (i.e. population) Sometimes also .prj projection information .shp.xml metadata Imagine if Word docs were split into 5 files!

5 Geometry features (.shp)
Actually just a list of coordinate sets Software connects each set into a polygon (1,3) X Y 0 0 0 2 1 3 2 2 (0,2) (2,2) (0,0)

6 Geometry projection (.prj)
The earth isn't flat, but maps are! Are my points GPS coordinates, or what? TWO Basic Types: Geographic (“GPS”) Latitude/longitude Pseudo-spherical Projected (“Survey”) Feet/meters Rectangular

7 Geometry attributes (.dbf)
Really just a dataset Contains one row per polygon in dataset ID Area Toxins Cases

8 GIS Junk (but don't delete!)
Shapefile index (.shx) Helps ArcGIS go faster (but still slower than QGIS) Metadata (.shp.xml) Data source, notes, etc. Other things in the (.shp) Presence of holes Bounding box Shape type (point, line, polygon)

9 The sp package in R Packs GIS data into an addressable object
You can also use [ ] notation to subset SpatialPointsDataFrame @ @ @ proj4string polygons data bbox $ $ plotOrder var1 var2

10 Working with spatial data
With rgeos and rgdal installed, common data commands will be intuitively translated! plot(myshape) myshape$var1 myshape[1:2,] myshape[myshape$var1==FALSE,] Sp objects work like any other object: mile3 <- gbuffer(myshape,3*5280) cents <- gcentroid(myshape)

11 Caveat: Don't use merge()!
Sometimes need to link attribute/shape data US Census Data TIGER Line Files Don't use merge()! Looks good but doesn't work This re-orders the data, but NOT the shapes! Instead, re-order the new data & append to old Example in lab

12 Lab Import an ESRI shapefile (w/built-in data) Basic maps with plot()
Link attribute data to spatial data Write to .kml so you can show your maps on Google Earth (good for interactivity). Examples of working with Google Earth/QGIS


Download ppt "Learn R! GIS."

Similar presentations


Ads by Google