Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spatial Analysis in R Points, lines, polygons, & raster! 06/16/2016

Similar presentations


Presentation on theme: "Spatial Analysis in R Points, lines, polygons, & raster! 06/16/2016"— Presentation transcript:

1 Spatial Analysis in R Points, lines, polygons, & raster! 06/16/2016
GUND institute for Ecological Economics University of Vermont Insu Koh

2 Review Read spatial data Check projection:
Reproject raster data Three options! projectRaster( …, method= ‘bilinear‘ or ‘ngb’) for DEM data: ‘bilinear‘ for NLCD data: ‘ngb’ Additional work for NCDL data Check DBF file Check legend slot in raster layer Overlay data set Make legend! ArcGIS

3 Google map in R library(dismo) Additional material:
gmap: download base google map Google Earth is in a geographic coordinate system with the wgs84 datum. (EPSG: 4326) +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs Google Map is in a projected (Mercator) coordinated system that is based on the wgs84 datum. (EPSG: 3857) SR-ORG:7483 = EPSG: WGS84 Web Mercator +init=epsg:3857 +proj=merc +a= b= lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +wktext +no_defs Additional material:

4 Google map in R library(googleVis)
Plotting point data on a google map web gvisMap gvisGeoMap

5 Point 1. Create spatial data from GPS information 2. Calculate distance among points: Euclidean distance, Great Circle distance. 3. Sample points randomly spsample() : sample types: random, stratified, … spsample set.seed(): define your random number then keep return same result! 4. Make buffer: use gBuffer{rgeos} 5. Subset & query point data same as subseting dataframe in R Bivand et al P. 35

6 Line Polygon Zonal statistics: how many points are in each polygon?
Create lines Make buffer Distance from point to lines Polygon Assessing coordinate information Bivand et al P. 40 Zonal statistics: how many points are in each polygon?

7 Raster Class: extent, resolution, projection.
Basic functions in raster packages Create your own raster Get or assign the value Crop raster boundary [1,1] or [1] [1,10] or [10] [?,?] or [?] [10,10] or [100] newr = raster(nrows=10, ncols=10) values(newr) = 1:ncell(newr)

8 Raster RasterStack and the RasterBrick Raster algebra
The principal difference between these two classes is that a RasterBrick can only be linked to a single (multi-layer) file. In contrast, a RasterStack can be formed from separate files and/or from a few layers (’bands’) from a single file. Raster algebra Math Aggregation/moving window Overlay Reclassification Zonal statistic .


Download ppt "Spatial Analysis in R Points, lines, polygons, & raster! 06/16/2016"

Similar presentations


Ads by Google