Several packages need to be installed to run code examples - install packages(" rgdal") install packages("sf") install packages("raster") install packages("rgeos")
Previous PDF | Next PDF |
[PDF] Package rgeos
7 sept 2020 · stalling the package from source, must be correctly installed first Windows and Mac In- URL https://r-forge r-project org/projects/rgeos/
[PDF] Package rgeos
7 sept 2020 · stalling the package from source, must be correctly installed first Windows and Mac In- URL https://r-forge r-project org/projects/rgeos/
[PDF] Getting Started with Package sampSurf
stall packages You can install the package from within R with gests' both the rgl and rgeos packages, which must be installed separately The rgl package
[PDF] Software installation instructions - ISRIC
For the training the following packages are used and should be installed prior to the training: ○ R packages: sp, rgdal, gstat, rgeos, GSIF, plotKML, caret, plyr,
[PDF] Spatial Data in R - Michael Dorman
Several packages need to be installed to run code examples - install packages(" rgdal") install packages("sf") install packages("raster") install packages("rgeos")
[PDF] Package rgeos
29 mar 2013 · library is external to the package, and, when installing the package URL https:// r-forge r-project org/projects/rgeos/ http://trac osgeo org/geos/
[PDF] R Scripts related to Analyzing spatio-temporal data with R
with R: Everything you always wanted to know – but 4 ) Estimating a space- time covariance function 43 4 1) Data preparation install packages( rgeos)
[PDF] RGeostats Manual - Free
20 août 2017 · Getting Started manual for installation of RGeostats package RGeoS is based on a library of geostatistical code written in C (and C++)
[PDF] Progress in the R ecosystem for representing and handling spatial
9 oct 2019 · rgdal and rgeos (and terra rather than raster), but existing packages are free packages available to users who are not able to install R source
[PDF] how to install telugu font in windows 10
[PDF] how to install vmware horizon client on mac
[PDF] how to integrate
[PDF] how to introduce yourself in a scholarship essay
[PDF] how to invoke the 5th amendment
[PDF] how to join bricklayers union
[PDF] how to join the adobe solution partner program
[PDF] how to know if confederate money is real
[PDF] how to learn 3ds max
[PDF] how to learn from a math textbook
[PDF] how to learn socket programming in c
[PDF] how to learn tenses in english in easy way pdf
[PDF] how to list the apa manual on your reference page
[PDF] how to lock a pdf so it cannot be copied
Spatial Data in R: Overview and Examples
Earth Observation Workshop, Basel
Michael Dorman
Geography and Environmental Development
dorman@post.bgu.ac.il2018-02-26 - 2018-03-01
Contents
I The aim of this tutorial is to provide anoverviewtospatial analysis in R ISlides and codeavailable onGitHub
IDataavailable onDropb ox
Requirements
ISeveral packagesneed to be installedto run code examples -install.packages("rgdal") install.packages("sf") install.packages("raster") install.packages("rgeos") install.packages("geosphere") install.packages("rmapshaper") install.packages("gstat") install.packages("automap") install.packages("spdep") install.packages("spatstat") install.packages("osmdata") install.packages("mapview")Requirements
ISet toworking directorywith thed ata-
I cb_2015_us_state_5m-US states (Shapefile)Ius-states.geojson-US states (GeoJSON)
Idem.tif-Digital Elevation Model (GeoTIFF)
Introduction
I Ris aprogramming languageandenvironment, originally developed forstatistical computingandgraphics I Over time, there was an increasing number ofcontributed packagesfor handling and analysing spatial data in R I Today, spatial analysis is amajor functionality in R IAs of November 2017, there are over180 packages
specifically addressing spatial analysis in RFigure 1:Bo okson Spatial Data Analysis with R
History
I pre-2003: Variable and incomplete approaches (MASS, spatstat,maptools,geoR,splancs,gstat, ...) I2003: Concensus that a package with base classes should be
useful;rgdalreleased on CRAN I2005:spreleased on CRAN;spsupport inrgdal
I2008:Applied Spatial Data Analysis with R, 1st ed.
I2010:rasterreleased on CRAN
I2011:rgeosreleased on CRAN
I2013:Applied Spatial Data Analysis with R, 2nd ed.
I2016:sfreleased on CRAN
HistoryFigure 2:The net works tructureof CRAN 1;specosystem shown in green1blog.revolutionanalytics.com/2015/07/the-network-structure-of-cran.html
R as a GIS?
IStrengthsof R as a GIS
IR capabilities indata processingandvisualization, combined with dedicatedpackages for spatial data IAsingle environmentencompassing all analysis aspects - acquiring data, computation, statistics, visualization, Web, etc. IGeneraladvantages of programming
I Automation- Doing otherwise unfeasible repetitive tasks IReproducibility- Precise control of instructions to the computer ISituations whenother toolsare needed
I Interactive editing or georeferencing(but seemapedit) IUniqueGIS algorithms(label placement, network routing, splitting lines at intersections, etc.) IData thatcannot fit in RAM(but R canconnect to spatial databases)Notable packages
IHandling spatial data
I sp,rgdal,rgeos,sf,raster IGeometry
I geosphere,mapshaper IStatistics
I gstat,automap,spatstat,spdep IData access
I osmdata IVisualization
I ggplot2,ggmap,mapview,leafletVector: Types of dataPOINTLINESTRINGPOLYGON
MULTIPOINTMULTILINESTRINGMULTIPOLYGONGEOMETRYCOLLECTIONFigure 3:V ectordata t ypes(Simple F eatures)Vector: File formats
IBinary
IESRI Shapefile(.shp,.shx,.dbf,.prj, ...)
IPlain Text
IGeoJSON(.jsonor.geojson)
IGPX(.gpx)
ISpatial Databases
IPostGIS / PostgreSQL
Vector: Data structures (sp)
IPackagesphas6 main classesfor vector layers
I One for eachgeometry type(points, lines, polygons) IOne forgeometry onlyand one forgeometry with attributesTable 1
Spatial data structure sin package spclass geometry attributesSpatialPointsPoints -
SpatialPointsDataFramePointsdata.frame
SpatialLinesLines -
SpatialLinesDataFrameLinesdata.frame
SpatialPolygonsPolygons -
Vector: Data structures (sf)
IPackagesfdefines ahierarchical class system
IClasssfgis for asingle geometry
IClasssfcis aset of geometrieswith a CRS
IClasssfis alayer with attributes
Table 2
Spatial data structure sin package sfclass hierarchy data sfggeometry coords, type, dimension sfcgeometry column Set ofsfg+ CRS sflayersfc+ attributesRaster: Types of data
Figure 4
Raster data t ypes
Raster: File formats
I "Simple" rasters IGeoTiff(.tif)
IErdas Imagine Image(.img)
I "Complex" rasters (>3D and / or metadata) IHDF(.hdf)
INetCDF(.nc)
Raster: Data structures
ITherasterpackage defines3 classesfor raster data
IRasterLayerforsingle-band
IRasterStackandRasterBrickformulti-band
Table 3
Spatial data structu resin package rasterclass layers storageRasterLayer1 Disk or RAM
RasterStack>=1 Disk and/or RAM
RasterBrick>=1 Disk (single file) or RAM
Input and output of spatial data
IReading spatial layers from a file into an R data structure, orwriting the R data structure into a file, are handled by external
libraries - I OGRis used for reading/writing vector files, withrgdal/sp orsf IGDALis used for reading/writing raster files, withraster IPROJ4is used for handling CRS, in bothrgdal/sp,sfand raster IWorking with specialized formats, e.g.HDFwithgdalUtils orNetCDFwithncdf4Coordinate Reference Systems (CRS)
IACoordinate Reference System (CRS)defines how the
coordinates in the data relate to the surface of the Earth ITwo types of CRS
IGeographic- longitude and latitude, in degrees
IProjected- implying flat surface, associated with measurement units (e.g. meters) Coordinate Reference Systems (CRS)Figure 5:Geographic (W GS84; left) and p rojected(NAD83 / UTM zone12N; right) CRS33https://geocompr.robinlovelace.net/spatial-class.html
Coordinate Reference Systems (CRS)
IIn R, CRS are defined using anESPG codeorPROJ.4 string IComparing Map Projections
I A table with EPSG code and PROJ.4 strings for all projections -crs =rgdal ::make_EPSG()Coordinate Reference Systems (CRS)
IFor example, theWGS84 geographic projectioncan be
defined using itsEPSG code4326 I Or using itsPROJ.4 string"+proj=longlat +datum=WGS84 +no_defs" rgdal,sf,raster: Handling spatial data I FunctionreadOGRcan be used to read vector layers intosp data structures -library(rgdal) pol_sp =readOGR("data","cb_201 5_us_state_5m") ## OGR data source with driver: ESRI Shapefile ## Source: "data", layer: "cb_2015_us_state_5m" ## with 49 features ## It has 1 fields class(pol_sp) ## [1] "SpatialPolygonsDataFrame" ## attr(,"package") ## [1] "sp" rgdal,sf,raster: Handling spatial data I Functionst_readcan be used to read vector layers intosf data structures -library(sf) pol_sf =st_read("data/cb_2015_us_state_5m.shp")## Reading layer?cb_2015_us_state_5m?from data source?/home/michael/Dropbox/Presentations/p_2018_02_EO_Workshop_Basel/data/cb_2015_us_state_5m.shp?using driver?ESRI Shapefile?
## Simple feature collection with 49 features and 1 field ## geometry type: MULTIPOLYGON ## dimension: XY ## bbox: xmin: -124.7332 ymin: 24.51496 xmax: -66.9499 ymax: 49.38436 ## epsg (SRID): 4326 ## proj4string: +proj=longlat +datum=WGS84 +no_defs class(pol_sf) ## [1] "sf" "data.frame" rgdal,sf,raster: Handling spatial data I Sincesfis new, the majority of the R-Spatial ecosystemonly works withsp I "Migration"document betweenspandsf I