1

I originally asked this on Stack Overflow, but here was suggested as a better location.

Where could I get a shapefile (or even better an R spatial polygon data frame) of the boundary of England, where London is a boundary and the London area is not part of the shape (essentially a really really weird doughnut...see below) or is there a way to create it myself (using GIS excluded!)?

enter image description here

5
  • 2
    This would be easy to create with GIS; why is using GIS excluded?
    – Phil
    Sep 13, 2016 at 12:43
  • I don't have access to GIS unfortunately!
    – tktk234
    Sep 13, 2016 at 13:13
  • 2
    QGIS is an open-source 'free' GIS qgis.org/en/site available for linux, windows and Mac OS X
    – Mapperz
    Sep 13, 2016 at 13:50
  • Using something like PostGIS to select outside a circle, bounding box, or other shape all polygons, you can get fairly close. To get more accurate, you need to use code and something like a defined set of boundaries to rip out London. After that, there are plenty of basics to convert PostGIS or other formats to a shapefile even if they involve a step or two. Sep 13, 2016 at 16:58
  • @Mapperz why "free"? It's just free... Sep 20, 2016 at 15:24

1 Answer 1

9

You can achieve this in R by downloading the Level 2 boundary data for the UK from GADM and choosing the option to download the R SpatialDataPolygonsDataFrame (.rds file).

In R:

library(sp)
library(maptools)

##read in the RData file
uk_gadm <- readRDS('GBR_adm2.rds')

##Filter the dataset to exclude London Borough and only include England 
uk_gadm_lesslondon <- uk_gadm[!grepl( 'London Borough*', uk_gadm$ENGTYPE_2) & uk_gadm$NAME_1 == 'England',]

##plot the output
plot(uk_gadm_lesslondon, col='red')

enter image description here

You can then dissolve the polygons using the approach included by radouxju or as follows:

uk_diss <- unionSpatialPolygons(uk_gadm_lesslondon, uk_gadm_lesslondon$ID_1, avoidGEOS=TRUE)

 plot(uk_diss, col='cyan')

enter image description here

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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