Section C.2 Data from Data Repositories
There are many places where you can access data relevant to your particular area of interest. For example, in the United Kingdom, one such service is the UK Data Service. This is a research council-funded comprehensive collection which includes major UK government-sponsored surveys, cross-national surveys, longitudinal studies, UK census data, international aggregate, business data, and qualitative data. A specific subset relevant to us is the Census Boundaries dataset, which is accessible through the Census Support Boundary Datasets.
To access this resource, we visit https://borders.ukdataservice.ac.uk/, where we can access all Census geography products since 1971. On this page, there is a link to the UK Data Service Census Geography eLearning Modules which are a set of resources designed to make users more familiar with the data and services available. There are also tutorials for QGIS and Python users.
To acquire boundary data from here, we can select the Boundary Data Selector option. When you get to the link, you will see on the top there is some notification to help you with the boundary data selector. If in the future you are looking for UK boundary data and you are feeling unsure at any point, feel free to click on that note, How to use Boundary Data Selector, which will help to guide you.
For a quick example here, we can download some Local Authority boundaries for England. In this case that means, for Country select “England”, for Geography select “Administrative”, and for Dates let’s go for “2011 and later”. Then, hit the button which says “Find” and see some options appear in the Boundaries box below. From these, let’s select “English Districts, UAs and London Boroughs, 2011”.
Once you have the file, you could select sub-areas. For this, hit the “List Areas” button, and select those relevant to you. Otherwise, you can move to Extract Boundary Data, where you will be taken to the next page.
Here you will have a list of possible choices of what versions of the boundary files to download. At the time of writing, these options are:
-
English Districts, UAs and London Boroughs, 2011
-
English Districts, UAs and London Boroughs, 2011, Clipped
-
English Districts, UAs and London Boroughs, 2011, Generalised (simplified polygon geometry)
-
English Districts, UAs and London Boroughs, 2011, Clipped and Generalised (simplified polygon geometry)
The choice here is similar to that of the
scale argument in the ne_countries() function above when we were getting boundary data from the rnaturalearth package. The first option is not changed, and so is the most geographically accurate file, but also therefore the largest in file size (which will later affect computation speed). Then there are increasing steps of simplification applied. For those interested in the Generalisation and Clipping process, see [271]. Generally, for crime-mapping purposes, we tend to go with the last option, but it will depend on the unit of analysis at which your data are collected, and the kinds of analysis you will do whether precision of the borders is important or not in your specific case.
Once you have chosen which file to download, you can also choose the format. This is between the options of: CSV, KML, MapInfo, or Shapefile. We make use of the shapefile format in this book; it is a very commonly used format for those originally trained on proprietary GIS software such as ESRI Arc Suite. On the other hand, KML files are neat, simple, and can easily be imported into R using the
st_read() function from the sf package. Again, it is up to you which format to choose, what you are familiar with, and whether other co-authors or collaborators might be using other GIS software which supports some formats better than others. R is flexible, so you can be too.
Here, let’s download the KML format of the most simplified geometry. Once you select this download, it will save a
.zip file to your computer. Make sure to put it in your working directory, and if you use sub-folders, then the relevant sub-folder. We have saved it to our “data” folder. We can extract (unzip) using R:
unzip('data/England_lad_2011_gen_clipped.zip',
exdir = "data/England_lad_2011_gen_clipped")
Now you see (if you are following the same structure as we are) there is a new sub-folder in the “data” directory called
England_lad_2011_gen_clipped which contains the .kml file, and a TermsAndConditions.html file. This will contain information about how you can use this map. For example, all your maps will have to mention where you got all the data from. So since you got this boundary data from the UKDS, you will have to note the following:
“Contains National Statistics data © Crown copyright and database right [year]. Contains OS data © Crown copyright [and database right] (year).”
You can read more about this in the terms and conditions document.
las <- st_read("data/England_lad_2011_gen_clipped/england_lad_2011_gen_clipped.kml")
And plot it to see:
ggplot() + geom_sf(data = las) + theme_void()

Subsection C.2.1 International Resources
And here we have our English Local Authorities. Now we realise that this is useful mainly for our audiences based in the UK, but we include this illustration as other countries use similar data repositories where you can get the relevant census geographies. For example, the United States Census Bureau has census shapefiles for the United States ([272]), Census Canada for Canada ([268]), the National Institute of Statistics and Geography (INEGI) for Mexico ([256]), and many more.
There are also resources which contain geography files for multiple countries. DIVA-GIS ([245]) is one such resource, which aims to collect free geographic data for any country in the world. The creators focus on studying the distribution of biodiversity; however, these maps can be useful for the crime mapper as well. Another collection comes from [259] who collect links to various GIS resources. Finally, international organisations or organisations which focus on international data can also provide a good starting point for sourcing your geographic data. For example, the Centers for Disease Control and Prevention (CDC) have a list of shapefiles for many countries on their website ([244]). There are probably many more, and sometimes it is just a case of a thorough internet search to find the right geography for your data.
