Articles by Kay Cichini

Make a KML-File from an OpenStreetMap Trail

September 26, 2014 | 0 Comments

Ever wished to use a trail on OSM on your GPS or smartphone? With this neat little R-Script this can easily be done. You'll just need to search OpenStreetMap for the ID of the trail (way), put this as argument to osmar::get_osm, convert to KML and you're good ... [Read more...]

R GIS: Function to Reverse KML Paths

May 3, 2014 | 0 Comments

This is a function I wrote up for reversing KML-paths. The paths within a KML can partially matched by their name-tags## name: ReverseKmlPath ## use: Reverser a KML-path by matching its ## arguments: PATH_TO_DOC the path to the KML-file## NAME the value of the name tag, function uses partial matching!## ... [Read more...]

R GIS: Generalizer for KML Paths

May 3, 2014 | 0 Comments

I'm posting a recent project's spin-off, which is a custom line-generalizer which I used for huge KML-paths. Anyone with a less clumpsy approach?## line generalizing function: takes two vectors of with x/ycoords ## and return ids of x/y elements which distance to its next element## is shorter than the ... [Read more...]

Use GDAL from R Console to Split Raster into Tiles

March 1, 2014 | 0 Comments

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 ... [Read more...]

Use Case: Spatial R & Google Earth for Terrain Analyses

February 5, 2014 | 0 Comments

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 ... [Read more...]

Get No. of Google Search Hits with R and XML

January 20, 2014 | 0 Comments

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 { require(XML) require(RCurl) url input, "\"", sep = "") CAINFO = paste(system.file(package="RCurl"), "/CurlSSL/ca-bundle.crt", sep = "") ... [Read more...]

R GIS: Polygon Intersection with gIntersection{rgeos}

September 16, 2013 | 0 Comments

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 ... [Read more...]

Batch Downloading Zipped Shapefiles with R

September 16, 2013 | 0 Comments

Here's a function I use to download multiple zipped shapefiles from url and load them to the workspace:URLs "http://gis.tirol.gv.at/ogd/umwelt/wasser/wis_tseepeicher_pl.zip")url_shp_to_spdf require(rgdal) wd td setwd(td) temp download.file(URL, temp) unzip(temp) shp lyr ... [Read more...]

Loading Multiple Shapefiles to the R-Console Simultaneously

September 10, 2013 | 0 Comments

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 # the assign function will take the string ... [Read more...]

R GIS: Terrain Analysis for Polygons as Simple as it Gets!

June 18, 2013 | 0 Comments

library(rgdal)library(raster)alt gadm gadm_sub plot(alt)plot(gadm_sub, add=T)asp slo __ extract(slo, gadm_sub, fun = mean, na.rm = T, small = T, df = T) ID slope1 1 9.9590532 2 1.0474433 3 7.4561654 4 1.6737865 5 11.946553__ extract(asp, gadm_sub, fun = mean, na.rm = T, small = T, df = T) ID aspect1 1 170.80652 2 184.01303 3 190.71554 4 136.89535 5 205.2115 [Read more...]

Use R to Bulk-Download Digital Elevation Data with 1" Resolution

June 18, 2013 | 0 Comments

Here's a little r-script to convenientely download high quality digital elevation data, i.e. for the Alps, from HERE:require(XML)dir.create("D:/GIS_DataBase/DEM/")setwd("D:/GIS_DataBase/DEM/")doc urls names for (i in 1:length(urls)) download.file(urls[i], names[i]) # unzip all files in ... [Read more...]

R Quick Tip: Shutdown Windows after Script Has Finished

May 21, 2013 | 0 Comments

Quite often I have long procedures running and want to do this over night. However, my computer would still be running all night after the script has finished. This is easily circumvented by the following lines that I put at the end of such a script:# set working dir# setwd("... [Read more...]

Creating a QGIS-Style (qml-file) with an R-Script

May 6, 2013 | 0 Comments

How to get from a txt-file with short names and labels to a QGIS-Style (qml-file)? I used the below R-script to create a style for this legend table where I copy-pasted the parts I needed to a txt-file, like for the WRB-FULL (WRB-FULL: Full soil code o... [Read more...]

Download File from Google Drive/Docs Programmatically with R

April 11, 2013 | 0 Comments

Following up my lattest posting on how to download files from the cloud with R..dl_from_GoogleD ## Arguments:## output = output file name## key = Google document key## format = output format (pdf, rtf, doc, txt..)## Note: File must be shareable! require(RCurl) bin ssl.verifypeer = FALSE) con writeBin(bin, con) close(... [Read more...]
1 2 3 6

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)