# Creating a Safe Route to School Map with MRN

### Software Requirements

QGIS 3.24 or later

### Data Requirements

*
* Import your `roadlink`, `pathlink` and `Multi-modal Routing Network` data into QGIS
* Reproject your `Multi-modal Routing Network` data into British National Grid (ESPG: 27700)
* Filter  `roadlink`, `pathlink` and `Multi-modal Routing Network` data further if needed, e.g. if only interested in roads under 30mph
* Import your residential and educational addresses into QGIS
* Select a school of interest from educational addresses and create this as a new layer

## Building the network

QGIS has built in tools for network analytics such as service area and shortest path. However, for a visually clearer output, we will be using a plugin called QNEAT3.

Select ‘*Plugins’ > ‘Manage and Install Plugins’* and search for ‘*QNEAT3’.* Select ‘*Install Plugin’*.

<figure><img src="/files/31PF7YT2yb02tsFOtVoZ" alt="Image of the QNEAT3 plugin for QGIS"><figcaption></figcaption></figure>

Once the plugin is installed, it will appear in the processing toolbox. The tool offers various analysis options, but for now select *QNEAT3 – Qgis Network Analysis Toolbox* > *Distance Matrices* > *OD Matrix from Layers as Lines (m:n).*

This will create a network output of the shortest paths between two sets of points.

### Creating the shortest distance network

* Use your `Multi-modal Routing Network` layer as your Network Layer
* Set From-Point Layer as residential addresses
* Set To-Point Layer as the example school address
* Set Generated matrix geometry style to be *Matrix geometry follows routes*

<figure><img src="/files/IWSdYx8wn49hc2PP95Ly" alt=""><figcaption></figcaption></figure>

### Joining attributes to the output network

Use **Join attributes by location (summary)** with `Multi-modal Routing Network`, joining to your new network and calculating mean `avgspeed:forward` along the routes

<figure><img src="/files/311B5XtXQOgaPbki6Yta" alt=""><figcaption></figcaption></figure>

Again use **Join attributes by location (summary)** with the merged `Multi-modal Routing Network` , joining to your new network and calculating mean `presenceofstreetlight_coverage` and `os_overallpavementpresence`

<figure><img src="/files/wOQu8qEqK4COCa0sp4kf" alt=""><figcaption></figcaption></figure>

### Merging `roadlink` and `pathlink` and joining streetlight attribution

Merge `roadlink` and `pathlink` layer together to make one layer using the Merge Vector Layers tool in QGIS

<figure><img src="/files/XFZC97IZC3CBAXwlsi91" alt=""><figcaption></figcaption></figure>

Use *Join attributes by location* with merged `roadlink` and `pathlink`, joining to your new network, setting the join type to ‘*largest overlap (one-to-one)*’ and taking the `presenceofstreetlight_coverage` attribute

<figure><img src="/files/MrJi5zYnKGsgHEqW8WRi" alt=""><figcaption></figcaption></figure>

### Adding a Score attribute

Open the *Field Calculator* in QGIS.

Add new attributes called `streetlightrating`, `20mphzone` and `presenceofpavementrating`, to OD Matrix layer and calculate a numerical value to these according to requirements.

Multiply these scorings together to get one overall rating for each route to school and style accordingly to highlight hotspots of safe and less safe routes

<figure><img src="/files/P3nkIc2SqdXhQqTdyO6x" alt=""><figcaption></figcaption></figure>

### Example Output – RAG Map

Each potential route from an address to the school is classified into Red, Amber and Green, which can help to highlight areas which may be less safe for school transport.

Routes can either be isolated if interested in a specific area or combined to give a clearer picture of walkability over a wider area.

Note that these are example ratings to demonstrate output and should not be taken verbatim.

<figure><img src="/files/Rp29WgUtfaN8paKlPQ7m" alt=""><figcaption></figcaption></figure>

### Possibilities to Enhance Results

* Filtering by Bus to look at bus routes to schools, and including bus stop data (e.g. NAPTAN)
* Look at crime statistics which may also affect route safety (e.g. ONS)
* Look at additional pavement attribution such as width of pavement for accessibility for buggies (in OS Data)

## Creating the RAG Map - step by step process

* Import your `roadlink`, `pathlink`, `Multi-modal Routing Network` and `averageindicativespeed` data into QGIS
* Reproject your `Multi-modal Routing Network` data into British National Grid (ESPG: 27700)
* Import your residential and educational addresses into QGIS
* Select school of interest and create this as a new layer
* Use *OD Matrix from Layers as Lines (M:N)* from *QNEAT3* Plugin, using your `Multi-modal Routing Network` as your Network Layer, From-Point Layer as being residential addresses, To-Point Layer being the school address and setting cost strategy to be along network features
* Use *Join attributes by location (summary)* with `Multi-modal Routing Network`, joining to your new network and calculating mean `avgspeed:forward` along routes
* Use Join attributes by location (summary) with `Multi-modal Routing Network`, joining to your new OD Network and calculating mean `os_overallpavementpresence` along routes
* Merge `roadlink` and `pathlink` layer together to make one layer
* Use Join attributes by location with merged `roadlink` and `pathlink`, joining to your new network, setting the join type to ‘largest overlap (one-to-one)’ and taking the `presenceofstreetlight_coverage` attribute
* Add new attributes called ‘`streetlightrating`’, ’`20mphzone`’ and ‘`presenceofpavementrating`’, to OD Matrix layer and calculate a numerical value to these according to requirements
* Multiply these scorings together to get one overall rating for each route to school
* Style accordingly to highlight hotspots of safe and less safe routes


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.os.uk/more-than-maps/routing/safe-routes-to-schools/creating-a-safe-route-to-school-map-with-mrn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
