The growth in online consumption and the shift in consumer culture towards convenience and value have impacted the health of retail centres in complex ways, potentially leading to long-term structural changes. The rise of online sales was particularly noticeable during the COVID-19 pandemic, as well as the shift towards value for money during the current ‘cost of living crisis’. Adapting to these trends has often involved the rationalisation of store portfolios and the adoption of new business models. Such an example in the UK is Marks & Spencer. M&S is closing some of its more expensive, less profitable larger stores and focusing on around 180 high-performing stores. At the same time, it is expanding its food business, aiming to have more than 420 food stores and Foodhalls.
Moreover, traditional town centre ‘brick-and-mortar’ retailers have primarily focused on supply-side factors such as competition, retail mix, and vacant spaces. However, there has been less emphasis on demand-side factors, such as catchment demographics, socio-economic characteristics, and their engagement with online shopping. Understanding the geography of consumer behaviour at a small area level is crucial for understanding the vitality and viability of both retail centres and the retailers themselves. Such consumer insights form the basis for site location analysis, in conjunction with an analysis of key competitors.
The Internet has revolutionised the way in which people consume products and services, however a variety of factors influence these use and engagement behaviours. Understanding the geography of these influences is complex, although, one way in which this has been made tractable is through various geodemographic classifications. However, these only tell you about the characteristics of the places in which people live and their environments, but not where they shop?
The objectives of this practical are:
a) to examine the geography of retail supply and demand related
factors;
b) to evaluate the extent to which retail centres are exposed to
consumers with different income and online consumption behaviour;
c) to choose the most suitable location for a new discount supermarket
in Liverpool.
In this case study you’ll take on the role of a property agent who is advising retail clients about those locations most suitable for their new premises.
In addition to reinforcing learning from earlier practicals, you will also be developing the following GIS skills and understanding:
Taking on the role of a location analyst, in no more than 1,250 words, write a short summary report that identifies the most suitable location in Liverpool (preferably, but not exclusively an existing shopping area such as town centre/high street or retail park) for a new corporate convenience store - M&S Simply Food that will have a click & collect facility, using the results of your GIS analysis as evidence. In your analysis you should consider: catchment characteristics (total population, affluence, geodemographics), Internet Use Classification (IUC) and competition between existing stores. Use data from the practicals on ‘Consumption spaces’ and ’People and Places, establish clear selection criteria, and use various GIS tools to conduct a location analysis. Your outputs should include at least: four maps, two tables and a flowchart showing the steps you have taken in your analysis.
In the first part of this practical we will explore the Internet User Classification (IUC) data for Liverpool. The IUC is created from over seventy measures selected from survey and lifestyle data, alongside census and infrastructure performance statistics.
In order to display the Internet Use Classification, we first need to
familiarise ourselves with the IUC User Guide (attached in
the CDRC IUC Geodata Pack) and then the structure of the associated
database, so we can decide what field to use best in order to display
our data. Follow the steps below:
In fact, we are going to create two maps: one showing aggregated classifications based on the IUC supergroup (main clusters), and the other showing disaggregated classifications based on the IUC group (nested subclusters).
This will create your first IUC map for Liverpool, well done! However, those default colours do not look great, do they?. In this instance, we are going to use ColorBrewer ColorBrewer pallets to display the different IUC groups and then we’ll remove the black LSOA outlines to produce a clearer and more professional-looking map.
IUC supergroupYour map disaggregated by IUC supergroup should look similar to the
one shown below:
IUC supergroup layer (right
click on IUC supergroup > Duplicate Layer) and create a map of IUC in
Liverpool using the IUC group variable (grp_nm).Note: You may need more colour schemes than those available by default in ColorBrewer. One option is to design your own symbol display, such as using line pattern fill or point pattern fill for your symbology. Importantly, the colour schemes used in both maps should correspond closely (e.g. if your supergroup 1 is in green, then groups 1a, 1b and 1c should also include symbols in a shade of green.) Can you think of why?
Name the layer: IUC group
List the groups in the right order (1a, 1b, 1c, 2a…) and name them including their respective group code and name
In Symbology, double click the symbol of each individual classified group name and explore different Fill style options (within Simple fill) such as line pattern fill or point pattern fill
Here is an example of a map displaying the
IUC group. Can you comment on it? Does the colour scheme
match that of the IUC supergroup map?
Note: The classification comprises of supergroups
(e.g. 1,2,3 etc. and nested groups e.g. 1a, 1b, 1c etc. So when you
display them on a map make sure that the color scheme makes sense. For
instance if super group 1 is displayed in green, all corresponding
nested groups (1a,1b and 1c)should be also displayed as different shades
of green)
Comment on the spatial patterns of internet use in Liverpool
Nationally, rates of online shopping equated to 53% when the research
was done, however there were differences between the IUC Groups as some
customers are more likely to shop online than others. For example,
groups 4c (low density but high connectivity), 4b (constrained by
infrastructure), 4a (e-fringe) and to an extent 2a (next generation
users) are most likely to engage in online shopping; whereas: 3a
(uncommitted and casual users), 1b (e-marginals: not a necessity) and 3b
(young and mobile) have lower than average propensities as shown on the
plot below.
So, in this part of the practical, we will examine the prevalence of online shopping and display the areas in Liverpool with the highest prevalence. In order to do so, we’ll need to do some variable recoding; in other words create a new variable where 1 is associated with higher prevalence of online shopping and 0 with lower. Do the following tasks:
Refer to the pen portraits of different IUC groups, available from the IUC User Guide
Open the Attribute Table of the
IUC_group layer
Click on Open field calculator and make sure
that the Create a new field box is ticked
In the Output field name type: Online_Shop
Choose from Functions window the Conditionals and then the CASE conditional (Check when and how we use CASE conditionals - there is some useful info provided in the window on the right hand side…)
Create a statement in the following format:
“WHEN condition = ‘x’ THEN the assigned value is ‘1’, otherwise (ELSE)
the assigned value is ‘0’”. In our case we assign the value of 1 to
groups 4a, 4b and 4c (high online shopping prevalence as shown in the
graph above), and all other IUC groups (lower prevalence) will have the
value of 0 assigned. Give it a go and then check your conditional
statement against the picture below:
Click Ok to create a new variable
Check the Attribute table - a new column showing our binary variable (0 or 1) should have been added
Now, we will display the new variable and then create a map that can be printed or published; more specifically a map showing the LSOAs with the highest propensity for online shopping. Follow the steps below:
IUC_group layer and click on
DuplicateOnline shopping prevalenceFor your map to be publishable, you need to add a legend, scale bar, north arrow, and possibly a title. By utilising the skills from the previous practicals, you should be able to complete it on your own.
RetailCentres_Liverpool layer from the
Practical 4_data folder and you have learnt in Practical 2 how to create
Liverpool boundary)However, creating only a binary variable masks some variance present in our data, so in this step, we will create an ordinal variable for which the values are ordered (the online shopping prevalence is captured from high to low). This approach allows us to capture more variance in online shopping behaviour, and if desired, we could use this variable to run a regression model.
IUC_group layerOnline Shopping CategoriesOpen the IMD folder in your working directory and load the shapefile for Liverpool(E08000012)
Name the layer IMD2015
Go to Properties open the Symbology tab and select Graduated from the drop down menu.
In the Value field choose income, type 5 in the Classes field and choose Equal Count as your Mode
Press Classify and then OK buttons; this will close the dialog and show you the map.
Again, render the image by using ColorBrewer and removing LSOAs outlines
Can you specify the threshold defining the lowest quintile of the
IMD Income domain for Liverpool?
To find this out, go to the Histogram tab within Symbology. Click Load Values and check the thresholds and distribution of the Income domain
By now, you should have created a map of Income deprivation domain
quintiles for Liverpool which looks something like the one below:
What do terms ‘quintile’ and ‘quantile breaks’ mean?
What is the mean value of the Income domain, and what are the standard deviation values?
There are other classification methods (Modes) available in QGIS; try them and see what difference do they make to the outcome map
Which method may be the most appropriate for this case
Your next task involves displaying the LSOAs within the lowest IMD quintile and then checking visibly whether there is an overlap between the IMD income domain and propensity for online shopping. Think about how you might proceed with this analysis… Give it a go; however, if you are stuck, follow the steps below:
IMD2015
layer and click on Select features using an
expression- How many polygons have you got selected?
Now, check whether there is any significant overlap between the LSOAs with the highest prevalence of online shopping and the least deprived IMD income quintile areas in Liverpool?
Online shopping prevalence layer and then select all the
LSOAs with the value of 1. You can do this by creating another simple
expression e.g. “Online_Shop” = 1Select features from - choose the
Online shopping prevalence layerBy comparing to the features from choose your
IMD2015 layer and again ensure that the Selected features
only box is checkedModify current selection by drop down menuIf we wanted to quantify the relationship between the Online shopping prevalence and the lowest quintile of the IMD2015 income variable we could divide the number of overlapping LSOAs by the number of LSOAs with the highest online shopping prevalence, which in our case is 39/60 = 0.65.
So, we could conclude that in Liverpool there is a relatively strong correspondence between the two variables as 65% of the LSOAs with highest prevalence of online shopping overlap with the lowest quintile of IMD income domain (highest income).
The IMD data we have used is from 2015, which is somewhat outdated.
For your assignment, you may consider using more recent IMD data, such
as from 2019 or even 2025. The latter was only released last year, so it
is much more up to date and definitely worth trying. Get additional
information from here: https://www.gov.uk/government/statistics/english-indices-of-deprivation-2025.
What is also important from a GIS user point of view, it uses the 2021
Census LSOA boundaries. You can obtain these from Practical 2
(Liverpool_pop2021.gpkg) and join the CSV table with the IMD 2025 data
available from your Practical_4 data folder.
Liverpool_pop2021.gpkg layer and the
IMD_2025_All_Data.csv tableLiverpool_pop2021.gpkg layer)Income Score variable, but
first make the variable numeric and permamentIncome 2025, use Decimal number as your Output
filed type)Income 2025 variableA more robust (statistical) analysis could also be done to explore
the relationship between all IMD domains (https://www.gov.uk/government/publications/english-indices-of-deprivation-2015-technical-report)
and online shopping propensity variables. First we could create and then
export a csv table with different variables. second, we could perform a
correlation test or even run a regression model to test their
statistical significance. This can be done in any statistical package
but we will use the legendary “R”.
- Go to Vector > Geoprocessing Tools >
Intersection
- Choose the the layers of interest such as
Online Shopping Categories and IMD2015 (also
using the Population layer from Practical 2 would be
useful) as your inputs and save the output to your working directory -
Name the output Intersect - Once Intersect appears in your
Layers Panel on QGIS export the Intersect
layer to your working directory as a.csv file (Right click >
Export > Save Features as..> Comma Separated Value (CSV)
as your format). Name it Intersect.csv
Note: If you’re having trouble with the previous step or your results differ from those used in here, you can use the pre-made .CSV file ‘Intersection.csv’ table for the next steps.
# Set your working directory
setwd("M:/Liverpool/Teaching/ENVS609/Practical 4")
## Tip: this has to be the path to your working directory, so a simple copy and paste of the above path won't work for you as this is my working directory##
variables <- read.csv ('Intersection.csv')
# Check the structure of your dataset (this shows all variables, their respective class and examples in your dataset)
str(variables)
Now you can run a simple correlation test between various variables. R can perform correlation with the cor() function. Built-in to the base distribution of the program are three routines; for Pearson, Kendal and Spearman Rank correlations. The default method is “Pearson” so you may omit this if that is what you want. First, let’s check whether there is a correlation between the ‘income’ and ‘Online_Shop’ variables’
note that R is case sensitive so always check whether a variable name uses lower or upper-case letters as otherwise you’ll get an error.
cor(variables$income, variables$Online_Shop)
# you can plot the relationship between the two variables by using the plot() function
plot(variables$income, variables$Online_Shop)
So there is negative relationship between the two variables (Pearson
coefficient = -0.53) but getting a correlation coefficient is generally
only half the story. Most certainly, you would like to know if the
relationship is significant. The cor() function in R can be extended to
provide the significance testing required. The function is cor.test().
We are going to test the IUC_ordinal variable this
time.
cor.test(variables$imd_score, variables$IUC_ordina)
plot(variables$imd_score, variables$IUC_ordina)
The above test indicates that the correlation is very significant as the p value is 2.2 to the power of -16, which is much smaller that the required 0.05 to reject the null hypothesis that there is no correlation between these two variables). If you want to check the correlation coefficients for a number of variables at once, create a correlation matrix by running the cor() function for the entire dataset: cor(my.variables, method = “pearson”). However, you have to ensure that your data consists of numerical variables only. There are various ways you can remove the unwanted (non-nuerical) variables (these are the initial 6 variables: lsoa_cd, lsoa_nm, supgrp_cd, supgrp_nm,grp_cd, grp_nm). First, we create a subset of the variables we need (my.variables <- variables 7 to 20). By doing this, we’re excluding the above 6 non-numerical variables.
my.variables <- variables[7:20]
str(my.variables)
Then remove the Factor/chr (non-numeric) variable (LSOA11CD) - in the dataset used to write this practical, this is the variable 3, but this may differ in your dataset (hopefully not). Run the code below to remove variable 3.
my.variables [,3] <- NULL
str(my.variables)
Now all your variables should be numeric/integers, so this means that you can create a correlation matrix.
c
plot(my.variables, method = "pearson")
At times, you may need a scatter plot you have created it. There is an easy way of saving it in R.
# Save the plot
png('correlation.png')
plot(my.variables, method = "pearson")
dev.off()
Check your scatterplot against the one below:
Finally, it is possible to check the statistical significance different variables (explanatory variables) have on the prevalence level of online sales (our dependent variable) by running a regression model. First, we’ll try a simple regression model with only one explanatory variable and then a multiple regression model with 3 different variables. This is done in R very easily by implementing the lm() function:
# Run a simple regression model
IUC.lm = lm(variables$IUC_ordina ~ variables$imd_score)
summary(IUC.lm)
# Run a multiple regression model
IUC.lm1 = lm(variables$IUC_ordina ~ variables$income + variables$education + variables$living_env)
summary(IUC.lm1)
The summary command is particularly useful in this case as it produces the coefficients so we can see which factors are statistically significant. We can also see the overall R-squared value for our model (the ‘Goodness of fit’ measure of our regression model). For instance, our simple regression model explains approx. 27% of the variation in the dependent variable (IUC_ordinal).
- How much variation in online shopping prevalence is explained by the multiple regression model?
A retail catchment can be defined as the areal extent from which the main patrons of a store or retail centre will typically be found. There are numerous ways in which catchments can be delineated, depending on the requirements for a particular study, available data, software used or the analytical capability of a practitioner. The simplest technique might be to draw buffer rings around a store or retail centre; however, such a technique is naive as it doesn’t consider geographical barriers or competition. More advanced methods referred to as ‘Gravity’ and ‘Spatial Interaction Models’ delineate catchment areas by considering the spatial distribution of competing locations and evaluating their relative attractiveness to different groups of the population.
In this practical session, we will be creating retail catchment areas using both basic and more advanced methods. We’ll start by creating buffer rings around retail centres in Liverpool, followed by drive distance polygons. Lastly, we will examine catchment areas based on a gravity model (Huff model in our case). The latter method will incorporate estimating retail centre attractiveness to depict the possible impact of retail hierarchy on the catchment extents.In this case we will use predefined index values available from the data pack ‘Liv_Attractiveness.csv’.
GB_RetailCentres (located in the retail folder)GB_RetailCentres layer as your input, IMD2015
(or any other layer with Liverpool boundaries) as your Clip (Overlay)
layer and save the new shapefile to your output folder. Name it
RetailCentres_LiverpoolGB_RetailCentres layerNext, we’ll define primary catchments, which are usually areas within a short distance from the retail centre and account for over 50% of patronage, and secondary catchments, which generally cover larger distances and represent patronage levels between 20% and 50%. We’ll use a straightforward approach — buffer rings — to create these catchments. Follow the steps below:
Create the Primary catchments by using a buffer distance of 2000m (go to Vector/Geoprocessing Tools/Buffer)
Fill in the dialog box as follows: select
RetailCentres_Liverpool as your Input
layer and type 2000 in the Distance
field
Save the Output shapefile to your working
directory; name it Buffer2000 (see the picture below)
Then create the secondary catchments by using Buffer distance of
4000m (repeat the above steps and name the new layer:
Buffer4000)
Render the image by adjusting colours, transparency etc.
Add labels by going to Properties of the
RetailCentres_Liverpool layer
Note: if the name is too long you can adjust it in the Toggle
editing mode - Go to the Attribute Table and
delete part of the name, leaving the desired name e.g. Allerton Rd - You
should now have created a map that looks similar to the one below:
Comment on the retail catchments computed by using the buffer
rings method:
- Can the primary catchments be distinguished easily from the -
secondary ones?
- Is the hierarchy within the retail centres accounted for in any
way?
- How do you think these representations could be
improved?**
Although the distinction between the primary and secondary catchment areas is reasonably clear, their extents are far from being realistic. One of the major reasons for it is that the so-called hierarchy of retail centres has not been accounted for. Typically, such hierarchy relate to their size, attractiveness and the geographical extent of retail centres influence, with those centres towards the upper end of a hierarchy typically offering a ‘multi-purpose shopping’ experience, and as such, drawing consumers from a wider area. Conversely, smaller town or district centres will typically serve a different function, and therefore be patronised more prevalently by local communities. Based on the Index of Retail Centres Attractiveness developed by Dolega et al. (2016) [https://www.sciencedirect.com/science/article/pii/S0969698915300412] and the retail hierarchies developed by Macdonald et al. (2022) [https://www.nature.com/articles/s41597-022-01556-3], at least three types of town/retail centres can be distinguished in Liverpool: Regional Centre (Liverpool), District Centres (Allerton Rd, Old Swan, Kirkdale), and Local Centres (the remaining centres). Note: this classification and data do not include Retail and Leisure Parks.
We can add information on retail hierarchy to the attribute table of the relevant shapefile (in our case-RetailCentres_Liverpool). We will have to create a new variable that will depict the hierarchy. We can do this by using the “CASE” conditional function, which allows us to add different values for each retail centre type directly within the attribute table. This approach enables efficient recoding, with each centre classified as a “Regional Centre,” “District Centre,” or “Local Centre” according to the hierarchy.
Go to the Attribute Table of
RetailCentres_Liverpool. Go to Field Calculator. Put
Hierarchy as the Output field
name
Create a statement:
CASE WHEN condition THEN result, ELSE result. A CASE
statement works like “if–then–otherwise”: if a condition is met, it
assigns a specified value; otherwise, it assigns an alternative value.
For example, if a centre’s hierarchy value is 1, label it “Regional
Centre.” In our case, we want to assign a value of 1 to Liverpool; value
of 2 to Allerton Rd, Old Swan and Kirkdale and value of 3 to the
remaining centres. Give it a go, however if you get stuck, try the
following statement:
CASE
WHEN “NAME” = ‘Liverpool’ THEN ‘1’
WHEN “NAME” = ‘Allerton Road’ THEN ‘2’
WHEN “NAME” = ‘Old Swan’ THEN ‘2’
WHEN “NAME” = ‘Kirkdale’ THEN ‘2’
ELSE ‘3’
END
Next, go to Vector > Geoprocessing Tools > Buffer
In the buffer window select RetailCentres Liverpool
layer as your Input vector layer and this time click on
Data defined override > Edit (next to the
Distance window)
Create another CASE conditional statement (similar
to the one above although the ‘condition’ will be different this
time)
Create a buffer distance based on the hierarchy: 5,000 meters for Hierarchy 1; then 2,000 meters for Hierarchy 2; and 1,000 meters for Hierarchy 3. Higher-level centres have larger buffers to represent their wider areas of influence.
Save the new Buffer rings to your working directory as Buffer_Hierarchy
The new buffers should be added automatically to the Layers Panel
Since you need to create a map of Buffer rings taking into
account the hierarchy of retail centres you should make your map very
clear. Try the following:
Adjust transparency of the newly created layer and try different colours and transparency, so the overlaps are visible
Label the centres and adjust the size of your points to reflect
the hierarchy - as shown on the map below (Use the
CASE, WHEN condition THEN result, ELSE, END) statement in
the layer’s Property > Size > Data defined override >
Edit field to display different sizes of points e.g. for
Hierarchy 1 - point size 5, Hierarchy 2 - point size 3 and Hierarchy 3 -
point size 2. Analogically, you could also use the CASE
conditional function to adjust the size of labels.
Despite the consideration of retail centre hierarchies, there are still significant limitations to the buffer approach, as it does not account for real-world barriers such as rivers, lakes, and railway tracks etc. A more accurate approach would be to consider road distances and drive time techniques. Both techniques are still popular amongst the major retailers, so we will make a use of it too. QGIS includes built-in service-area tools, but these offer more limited options for generating catchment polygons. More advanced workflows can use pgRouting, which requires additional database setup. For this tutorial, we will use ArcGIS Pro, which provides a more integrated workflow with direct polygon generation and greater control over travel modes and overlapping catchments. Follow the steps below:
Open ArcGIS by going to Start menu > ArcGIS Proand sign in using your university credentials
Click on the Map icon - a new map/project will open
Then check whether Network Analyst is enabled. Go to Project > Licensing > Configure you licensing options and then check the box next to Network Analyst
Then go back to your ARCGIS Project/Map and in the Catalog window, located on the right, right click on Folders and then Add Folder Connection
Browse to your Practical 4 data > Retail folder, click OK
The Retail folder should appear now in your Catalog window.
The ArcGIS setup is done now, so you’re ready to start your analysis
RetailCentres_Liverpool layer by dragging and
dropping the .shp file to the Table of ContentsRoadLiv layer to the Table of
Contents. (If you use a different version of ArcGIS Pro than
3.3.0, you’ll need to add the RoadLiv_ND.nd layer, which is
your Liverpool road network).Note: If the RetailCentres_Liverpool has been saved as a
geopackage, re-save the layer in QGIS as a shapefile first, and then add
it to your Practical 4 data > Retail folder
Click on the Analysis tab and then
Network Analysis > Service Area
A new layer called Service Area will be added to the
Table of Contents
Click on the Facilities and then select the Service Area Layer tab located at the top of ArcGIS toolbar
Add the retail centre locations by clicking on the Import
Facilities icon and choose RetailCentres_Liverpool
as your Input Locations, click Apply and then
OK
Once the retail centres locations have been added to the Facilities, set your Cutoffs to 1 (the distance units are preset to km), set your Mode as Driving Distance and your Direction to Away from facilities
By now, the NetworkAnalyst > Service Area
Layer window should look something like the picture
below:
Play with other settings e.g. use Polygons or Polygons and Lines under the Polygons tab drop down menu
Click the Run button
This will generate 10 service areas (retail catchments), each
delineated for 1km drive distance
You can also generate multiple drive times/distances by specifying two or more different distances in the Cutoffs window (e.g. type 1, 2 and hit the Run button again)
The output below shows the map of service areas for Liverpool
Retail Centres delineated for 1km and 2km
So if you want to export for example the 1km service areas, do the following:
Liv_DriveDist.shp.QGIS produces nicer maps than ArcGIS Pro (in my opinion!). However, if you would like to learn how to export maps as images or publishable maps, feel free to give it a go.
If you would like to produce a map suitable for an academic report or publication, follow these steps:
So this is how the drive or distance polygons are generated. At the moment we have generated 10 polygons of 1km and 2km, however if we wanted to account for the retail hierarchy, we would also need to generate a new service area of 5km for Liverpool city centre, three service areas of 2km for the district centres with the hierarchy of 2 (Old Swan, Allerton Rd and Kirkdale) and six service areas of 1km for the remaining centres. We will this in QGIS. - Load a road/path line layer and a retail-centre point layer in QGIS and then retail centre point layer.
Check the coordinate system - use British National Grid (EPSG:27700). (Reproject the actual layer if necessary)
Separate centres by hierarchy. Filter and export three point layers, so each group can use its own distance, name them H1, H2 and H3): Centre hierarchy Travel distance Name 1 5,000 metres H1 2 2,000 metres H2 3 1,000 metres H3
Go to Processing → Toolbox, search for Service area (from layer), and open it.
Set the inputs. Choose your network (RoadLivlayer)
and one hierarchy’s point layer (e.g. H1). Set Path
type to Shortest and enter the corresponding distance
under Travel cost (e.g. 1000, this is meters rather
than km).
Review advanced settings if you wish. You can set a sensible Maximum point distance from network to prevent distant centres from being connected automatically to unrelated roads.
Run . Save the Service area (lines) output and
name it Liv_H1_DriveDist
The result shows reachable network segments, not catchment polygons.
Repeat for the other two hierarchy groups - H2 and H3 layers.
Inspect the results.
Note: If QGIS reports a missing transformation grid, download the OSTN15 grid file provided in a link in the error message. If the problem still persists after downloading it - go to Settings → User Profiles → Open Active Profile Folder. Copy the downloaded file into the proj folder, creating it if necessary. Restart QGIS and rerun the analysis.
Next, overlay the generated service areas
(Liv_Herachy_DriveDist) onto the
Buffer_Hierarchy layer
Create a printable map showing the spatial extent of both types of retail catchments
Begin with opening a new “Print composer”, add a north arrow, scale bar and legend.
Once ready, export your map as a picture image and answer the questions below:
- What are the limitations of these approaches? - How could these be addressed?
Another way of estimating retail catchments (much more complex and
arguably more accurate) is to use a gravity model (also referred to as
Spatial Interaction Model (SIM)). We will use a probabilistic SIM, more
specifically the Huff model. It estimates the probability of each
domicile (LSOA in our case) to use a particular retail centre by taking
into account road distances and competition between centres as well as
their attractiveness and position within retail hierarchy. As such, this
information can be utilised to delineate primary, secondary and tertiary
catchment areas for each retail centre at the LSOA level of granularity.
The results referred to as Huff probabilities are available in the
Practical 4 data package, however if you wish to compute them by
yourself the code is below.
Note: You won’t need Huff catchments for your assignment
I recommend that you consider attempting this optional section only if you have strong R language skills and plenty of spare time. Some of the used R packgaes (rgdal, rgeos) have been removed from the CRAN repository, so you’d need to obtain them from the archives (https://cran.r-project.org/src/contrib/Archive/rgeos/; https://cran.r-project.org/src/contrib/Archive/rgdal/).
The huff_basic function is used to apply the Huff model which is part of the huff-tools package and for that reason we should import huff-tools into R. The “huff_tools.r” package is available in the retail folder so you should download the ‘Huff’ file and save it in your working directory. Once you are ready, follow the steps below:
# Set your working directory
setwd("M:/Liverpool/Teaching/Teaching 2023-24/ENVS609/Practical 4/Practical 4 data/Practical 4 data/retail")
# Import the huff-tools library
source("huff-tools.r")
The following libraries should be loaded automatically*:
library(rgdal)
library(rgeos)
library(igraph)
library(FNN)
library(dplyr)
Note: If you get an error saying that packages are unavailable, e.g. Error in import.packages(“rgdal”) : could not find function “import.packages” then you will need to copy the following code and Run:
install.packages("rgdal")
install.packages("rgeos")
install.packages("igraph")
install.packages("FNN")
install.packages("dplyr")
Next, we will use the ‘read.csv’ function to import the comma-delimited files (.csv table) into R. In most cases, the function can be applied by specifying just the name of the csv file as it assumes by default that the csv file has a header, and that the field separator character is ‘,’. These and other parameters can be modified if required (type: ‘?read.csv’ for more details). The function returns a data frame object and can be used as follows:
# load the data from your retail folder
attr_score <- read.csv('Liv_Attractiveness.csv')
distances <- read.csv('Liv_distances.csv')
We have now created two data frame objects. The “attr_score” data frame stores the attractiveness score of the retail centres (including ranking based on the hierarchy) while the “distances” object has the pre-calculated road distances between the centroids of each LSOA and the boundary of the retail centres.
A summary output of the data can be obtained with the ‘str’ and ‘summary’ functions. The former function outputs the name and type of each variable as well as the number of rows, while the latter function produces summaries depending on the type of the variable (e.g. quartiles, minimum and maximum values for continuous variables).
str(attr_score)
summary(attr_score)
str(distances)
summary(distances)
Next step involves joining the two tables we have created:
distances and attr_score. In R there are two commonly
used functions that perform data join: merge and
inner_join. In this practical we will use the latter.
The inner_join function uses a common field to merge the
tables. In our case it is the destinations_name field. Use the
code below (name the output huff_input):
huff_input <- inner_join(distances, attr_score)
# Note: If the column names differ use the 'merge' function and the 'by' argument to specify the names
str(huff_input)
So the output is a long table with 328,430 rows and 6 columns.
The next step is to assign different values to beta parameter based on the attractiveness rank.
This is easily done with an ifelse function. This
function returns an object which is filled with elements according to
whether or not a condition is met. It is also possible to nest two or
more ‘ifelse’ statements to evaluate more complex conditions.
In this practical we’ll use the retail centre hierarchy to develop the beta parameter (distance decay exponent) of the Huff model, assuming that retail centres at the top of the hierarchy should have a lower distance decay parameter (i.e. their attractiveness is reduced with distance but at a slower rate than in the case of the small centres).
For the major retail centres, which serve extensive catchments (Rank 1) use beta = 1.4, for the secondary retail centres, in our case the district centres (Rank 2) beta = 1.6 and for the smallest centres (Rank 3) beta = 1.8.
huff_input$beta <- with(huff_input, ifelse(Rank == 1, 1.4,
ifelse(Rank == 2, 1.6,1.8)))
Check whether the beta values have been allocated as required
# Display the first six values for Rank and beta fields
head(huff_input[,c("Rank", "beta")])
# Display the last six values for Rank and beta fields
tail(huff_input[,c("Rank", "beta")])
It should be noted that the beta values can be altered, depending on the requirements, estimation technique etc. The above used values were found to produce the most appropriate catchment areas for the national level. These, of course, may vary for the city level for a number of reasons: a) the number of competitors is smaller within a city, b) there is a violation of a boundary free modelling, and c) the retail hierarchy within a single city may vary from the national one.
We will use the huff_basic function to estimate Huff
patronage probabilities. The huff_basic function requires
the input of 6 arguments to run, namely:
The first four arguments are required, while the last two are optional, and if not provided, a default value will be used (i.e. alpha = 1, beta = 2). If you examine the huff_input data frame that we created earlier, you’ll realise that we have 5 of the required variables (names for destinations and origins, attractiveness score, distance and beta values), so we only need an alpha value. In this practical we’ll use the default value of 1.
huff_probs <- huff_basic (huff_input$destinations_name,
huff_input$AttrScore,
huff_input$origins_name,
huff_input$distance,
huff_input$beta,
alpha = 1
)
# display data summary
str(huff_probs)
The output of the huff-basic function is a table in long
format (all pairwise probabilities between origins and
destinations).
To extract the highest probabilities for each LSOA we can use the
select_by_probs function. The function will essentially
group the data by LSOA name, sort each of the group entries by Huff
probabilities (from higher to lower) and then extract the top number of
entries, where the number is specified as second argument in the
function. So to extract the highest entry (number = 1) for each LSOA, we
can run the following R snippet:
# Extract probabilities
sele_probs <- select_by_probs(huff_probs, 1)
In order to display the extracted Huff probabilities, we will create
a shapefile by merging our sele_probs data frame with a
shapefile of LSOAs provided for our study area. First we import the
shapefile into R with the readOGR function. The function
accepts as first argument the directory where the vector dataset is
located and as second argument the name of the dataset - note, there is
no need to add a file extension.
#use YOUR working directory for `the readOGR` function
origins <- readOGR("M:/Documents/Liverpool/Practicals2017/retail", "Liv_lsoas")
Then merge the spatial data object with our data frame.
# Merge with spatial object of LSOAs
origins@data <- data.frame(origins@data, sele_probs[match(origins@data$lsoa_cd, sele_probs$origins_name), ])
#delete column 1 as it is a duplicate of the `origin locations`
origins@data[,1] <- NULL
Final step of the modelling is to save the data as a shapefile in
your working directory. This can be done with the writeOGR
function. First create new folder with ‘dir.create’ function, then save
the results.
dir.create("Huff_results") # Create a new folder named results
# Save the origins shapefile in the "Huff_results" folder
writeOGR(origins, "Huff_results", "huff_probs", driver = "ESRI Shapefile")
#If you get a warning message, you can ignore it:
If you managed to calculate Huff probabilities - Well Done as this was really advanced spatial analysis in action! Otherwise you can use Huff probabilities from the Practical 4 data pack. So, you will now display HUff probabilities using various thresholds, and secondly: create catchments by allocating the LSOAs based on these probabilities to each retail centre
The picture below shows the catchment for Smithdown Rd, which is
highlighted in yellow
Answer the following questions: