Make a KML-File from an OpenStreetMap Trail
[This article was first published on theBioBucket*, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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 to go!Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
# get OSM data library(osmar) library(maptools) rotewandsteig <- get_osm(way(166274005), full = T) sp_rotewandsteig <- as_sp(rotewandsteig, what = "lines") # convert to KML kmlLine(sp_rotewandsteig@lines[[1]], kmlfile = "rotewandsteig.kml", lwd = 3, col = "blue", name = "Rotewandsteig") # view it shell.exec("rotewandsteig.kml")
To leave a comment for the author, please follow the link and comment on their blog: theBioBucket*.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.