Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting CORINE Land Cover Seamless Vector Data with R

DZone's Guide to

Getting CORINE Land Cover Seamless Vector Data with R

· Big Data Zone
Free Resource

Need to build an application around your data? Learn more about dataflow programming for rapid development and greater creativity. 

Thanks to a helpful SO-Answer I was able to download all CLC vector dataprogrammatically:

require(XML)
 
path_to_files <- "D:/GIS_DataBase/CorineLC/Seamless"
dir.create(path_to_files)
setwd(path_to_files)
 
doc <- htmlParse("http://www.eea.europa.eu/data-and-maps/data/clc-2006-vector-data-version-2")
urls <- xpathSApply(doc,'//*/a[contains(@href,".zip/at_download/file")]/@href')
 
# function to get zip file names
get_zip_name <- function(x) unlist(strsplit(x, "/"))[grep(".zip", unlist(strsplit(x, "/")))]
 
# function to plug into sapply
dl_urls <- function(x) try(download.file(x, get_zip_name(x), mode = "wb"))
 
# download all zip-files
sapply(urls, dl_urls)
 
# function for unzipping
foo <- function(x) try(unzip(x))
 
# unzip all files in dir and delete them afterwards
sapply(list.files(pattern = "*.zip"), unzip)
 
# unlink(list.files(pattern = "*.zip"))

Check out the Exaptive data application Studio. Technology agnostic. No glue code. Use what you know and rely on the community for what you don't. Try the community version.

Topics:

Published at DZone with permission of Kay Cichini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}