1

I stumbled over the following site and I wanted to download the data for the digital elevation model for the waterways.

https://www.govdata.de/web/guest/daten/-/details/1c669080-c804-11e4-8731-1681e6b88ec1bkg

Now, I have following problem, I do not understand how I can download the data.

Anybody knows how I could download the data, e.g. by using the programming language R or Python.

Mr.Man
  • 37
  • 6
  • 1
    Considering figuring out how to download a file using Python: https://stackoverflow.com/questions/11768214/python-download-a-file-over-an-ftp-server OR https://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python – J. Martin Aug 14 '17 at 21:12

1 Answers1

0

You will need to be on the webpage where the data is stored, not the webpage with the links to the data. Depending on what format the data is in you will need to change the (sep='\t') to fit your needs,

ex. a csv would be (sep=',')

You will then need to fine tune the formatting.

library(RCurl)

urlcontent<- 
getURL('https://www.govdata.de/web/guest/daten/-/details/1c669080-c804-11e4-
8731-1681e6b88ec1bkg')

DATA<- read.table(textConnection(urlcontent), header=T, sep = '\t')

Note the read.table function may only work with a tsv type page, you will need to fine tune the reading of the page based on the formatting.

EDIT:

Using the link address for the URL I was able to successfully grab the URL, the problem though is an access error, I do not have access to download the data. This may be another error in the code, or an actual credential problem on the website side.

library(RCurl)

urlcontent<- 
getURL('https://www.govdata.de/ckan/api/rest/dataset/1c669080-c804-11e4-
8731-1681e6b88ec1bkg')

DATA<- read.table(textConnection(urlcontent), header=T, sep = '\t')

Error:You don't have permission to access this server

Chabo
  • 2,842
  • 3
  • 17
  • 32
  • However, I still do not understand how to get the URL where the data are stored. They provide an API and also some kind of CKAN format, and as I understood, this should allow you to download the data very easily. I found a package called CKANR (https://github.com/ropensci/ckanr), however, I do not understand how this works. On the Webpage (https://www.govdata.de/web/guest/daten/-/details/1c669080-c804-11e4-8731-1681e6b88ec1bkg) you find 5 Links which are doneted with ATOM, XML, WMS and CKAN, and I thought in some way those provide ways to get the data in an uniform way. – Mr.Man Aug 15 '17 at 06:27
  • @Mr.Man Awesome, thanks for the info. I'll look into it more today – Chabo Aug 15 '17 at 15:10