I'm in the process of generating a series of choropleth maps for a journal article and am writing this up in R as an .Rmd. My aim is to set this up as reproducible research, that is in a form which can be executed and recompiled by other users. Towards this end, I'm looking for a UK (or ideally Scotland) shapefile with LAU2 level administrative boundaries (i.e. local parishes) that can be downloaded directly to R. I'm already doing this for various CSV POI files using getURL() as shown below:

ecs <- read.csv(text=getURL("http://datashare.is.ed.ac.uk/bitstream/handle/10283/1943/ECS-GIS-Locations_2.9_simplified.csv"))

So I'd like to find something similar which is available as a persistent URL ideally from a reliable repository.

The OS BoundaryLine data would be great, except that it sits behind a request form that has to be filled out and then a download URL is provided via email. As discussed on a related thread, GADM and Natural Earth are terrific resources, but AFAIK don't provide parish or county-level boundaries. Can anyone recommend an alternative, but nonetheless canonical / reliable alternative?

  • Have you thought about hosting the unzipped parish boundaries locally? You'd be free to do that just as long as you acknowledge the license. – Andrew Tice Apr 18 '16 at 9:50
  • Thanks Andrew, I think that's the ticket. I'm in the midst of compiling these data sets and will put URLs up here as an answer to my own question. – Jeremy Kidwell Apr 19 '16 at 14:00
  • Jeremy....that's a very kind thought, but if I were you I'd keep the URLs private. The CC agreement is for use within a product not sharing "as is". Also you could end up with additional traffic / security issues on your server. This is a public site'! – Andrew Tice Apr 19 '16 at 20:40
  • Have you looked at the UK Data Service easy download function? They have 1991 Parishes, but I don't know if they're the most up to date: census.edina.ac.uk/easy_download.html – Phil Apr 20 '16 at 8:52
  • Wow thanks Phil - that's exactly what I was looking for. Combined with a decompression package in R I think it will work perfectly for reproducible work! I'll post an answer here in a few days summarising my findings. Thanks to you both for the help. – Jeremy Kidwell Apr 23 '16 at 19:44

The UK Data Service: Census Support host UK administrative geography shapefiles that can be downloaded directly through their Easy Download service.

In an Rmd file to download and load parishes it can be as easy as inserting the following code into an appropriate chunk:

if (dir.exists("parishes") == FALSE) {
download.file("https://census.edina.ac.uk/ukborders/easy_download/prebuilt/shape/England_cp_1991.zip", destfile = "parishes/parishes-1991.zip")
unzip("parishes/parishes-1991.zip", exdir = "parishes")
parishes <- rgdal::readOGR(dsn = "parishes", "england_cp_1991")

I create a directory called parishes programmatically in the first step in case anyone attempting to reproduce my code doesn't have an appropriate directory created (in which case download.file throws a wobbly).

To obtain the actual URL of the appropriate shapefile copy the link from the appropriate page, using the shapefile option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.