Publications by Kay Cichini
Spatial Overlays with R – Retrieving Polygon Attributes for a Set of Points
A short tutorial for spatial overlays using R-GIS..library(sp) library(dismo) # spatial data alt <- getData('alt', country = "AT") gadm <- getData('GADM', country = "AT", level = 2) # view plot(alt) plot(gadm, add=T) # some addresses pts <- geocode(c("Aldrans, Grubenweg", "Wien, Stephansdom", "Salzburg, Mozartplatz")) # make it sp...
459 sym R (702 sym/1 pcs)
Text Mining with R – Comparing Word Counts in two Text Documents
Here’s what I came up with to compare word counts in two pieces of text. If you got any idea, I’d love to learn about alternatives!## a function that compares word counts in two texts wordcount <- function(x, y, stem = F, minlen = 1, marg = F) { require(tm) x_clean <- unlist(strspl...
539 sym R (2242 sym/1 pcs)
Loading Multiple Shapefiles to the R-Console Simultaneously
A quick tip on how to load multiple shapefiles (point shapefiles, i.e.) to the R console in one go:library(sp) # get all files with the .shp extension from working directory setwd("D:/GIS_DataBase/GIS_Tirol/Tirol_Verbreitungskarten/Verbreitungs_Daten") shps <- dir(getwd(), "*.shp") # the assign function will take the string repres...
507 sym R (376 sym/1 pcs)
Follow Up on Spatial Overlays with R – Getting Altitude for a Set of Points
A short follow up on a previous post on spatial overlays with R. library(sp) library(dismo) # some addresses in Austria pts <- geocode(c("Aldrans, Grubenweg", "Wien, Stephansdom", "Salzburg, Mozartplatz")) # make pts spatial coords <- SpatialPoints(pts[, c("longitude", "latitude")]) spdf_pts <- SpatialPointsDataFrame(coords, pts) #...
473 sym R (1290 sym/1 pcs) 2 img
Batch Downloading Zipped Shapefiles with R
Here’s a function I use to download multiple zipped shapefiles from url and load them to the workspace:URLs <- c("http://gis.tirol.gv.at/ogd/umwelt/wasser/wis_gew_pl.zip", "http://gis.tirol.gv.at/ogd/umwelt/wasser/wis_tseepeicher_pl.zip") url_shp_to_spdf <- function(URL) { require(rgdal) wd <- getwd() td <- tempdi...
511 sym R (618 sym/1 pcs)
R GIS: Polygon Intersection with gIntersection{rgeos}
A short tutorial on doing intersections in R GIS. gIntersection{rgeos} will pick the polygons of the first submitted polygon contained within the second poylgon – this is done without cutting the polygon’s edges which cross the clip source polygon. For the function that I use to download the example data, url_shp_to_spdf() please ...
750 sym R (888 sym/1 pcs) 2 img
Get No. of Google Search Hits with R and XML
UPDATE: Thanks to Max Ghenis for updating my R-script which I wrote a while back – the below R-script can now be used again for pulling the number of hits from Google-Search.GoogleHits <- function(input) { require(XML) require(RCurl) url <- paste("https://www.google.com/search?q=\"", input, "\"", sep ...
693 sym R (648 sym/2 pcs)
Use Case: Spatial R & Google Earth for Terrain Analyses
I’d like to share code that uses spatial R and Google Earth for terrain analyses. In this example I took SRTM data at 1″ resolution from http://www.viewfinderpanoramas.org/dem3.html#alps read it into R did a little processing and finally wrapped it up in a KML-file that I use as ground-overlay in Google Earth. In fact I eventually...
843 sym 2 img
Use GDAL from R Console to Split Raster into Tiles
When working with raster datasets I often encounter limitations caused by the large size of the files. I thus wrote up a little R function that invokes gdal_translate which would split the raster into parts.The screenshot to the left shows a raster in QGIS that was split into four parts with the below script.## get filesnames (assuming...
334 sym R (1363 sym/1 pcs) 2 img
Use Case: Make Contour Lines for Google Earth with Spatial R
Here’s comes a script I wrote for creating contour lines in KML-format to be used with Google Earth https://github.com/gimoya/theBioBucket-Archives/blob/master/R/r_contours_for_google_earth.RIf you want to check or just use the datasets I created for the Alps region, you can download it here: http://terrain-overlays.blogspot.co.at/index.html R...
739 sym 2 img