Unzipping rasters in QGIS

Recently I walked the first half of the Cotswold Way (from North to South). While planning the second half, working out how many miles to attempt each day, I wanted to compare the terrain for the two halves of the walk.

The Ordnance Survey provide, as Open Data, a Digital Terrain Model (DTM) based on a 50m grid size, which is a good enough resolution for my purposes. Unfortunately the 158Mb download is for the whole of Great Britain. Another added complication is that the zip file contains a number of other zip files, one for each 10km tile. I wanted to automate the process of extracting only the necessary tiles and adding them as layers in QGIS.

The first stage was to get the 10km grid as a QGIS layer, to determine which tiles I needed. It is possible to download all of the OS grids as a geopackage. Here the 10km grid is shown along with the route of the Cotswold Way (downloaded as a gpx file from the National trails website). I have added a 1km buffer to the route since it will be useful to also get tiles very close, but not intersecting the route (e.g. tile ST89):

Continue reading “Unzipping rasters in QGIS”

What’s in a name?

An exploration of the Ordnance Survey’s OS Names API using Leaflet.

The OS has made a number of APIs available via its DataHub. Individuals can sign up for the DataHub and use the APIs for no charge as long as usage is kept within reasonable limits. This is a great invitation to experiment. This particular exercise was based on the OS’s Find a name example using the JavaScript mapping library Leaflet.

Continue reading “What’s in a name?”

GIS for data analysts

A while ago (pre-covid) I delivered a day of GIS training for a company where data science is a key part of what they do. The focus was on human rather than physical geography, so vector data rather than raster data. Since the course was based on QGIS and GeoDa, both open source tools, and we used open data for all of the examples, I thought it only fair to share the materials using a creative commons license. The link below is to the training materials.

GIS for data analysts

Extracting town road networks from OpenStreetMap

A while ago I worked on  a project that analysed the road networks in a number of towns and cities in England. Initially, we used the Ordnance Survey’s Integrated Transport Network (ITN). The process to extract an ITN network for a specific town was as follows:

  1. Using Digimap, extract the ITN network for a bounding box around the specific town.
  2. Extract the boundary polygon for the town and then trim the network to that polygon
  3. Tidy the road network – removing nodes (junctions) without edges (links), edges without a node at either end and disconnected islands. Fortunately, these tasks can be carried out within QGIS.

As you can imagine, this process is time-consuming and it limited the number of towns that we could analyse. Continue reading “Extracting town road networks from OpenStreetMap”

Danny Dorling and the GeoPandas

Churchyard, Cornwall

I recently picked up a copy of Danny Dorling’s So You Think You Know About Britain (Dorling, 2011) from a second-hand bookshop and it inspired me to explore some demographic data using Python and, in particular, GeoPandas.

The book discusses topics such as life expectancy, gender imbalances in the population, the concept of “optimum population”, migration, an aging population and aims to dispel the many myths that surround these matters. Continue reading “Danny Dorling and the GeoPandas”

Python, matrices, arrays, and the National Trip End Model

Travel demand in a matrix

Travel demand can be expressed using origin-destination (OD) matrices. In this example we have 4 zones:

1 2 3 4
1  10 2 9 18
2  3 2 2 1
3  2 1 15 17
4  1 3 1 4

The origins are in rows and the destinations are in columns, so number of trips from zone 1 to zone 2 is 2 and the number of trips from zone 3 to 4 is 17. Let’s say that this data is for weekday commuting trips by rail. To determine the total number of trips from zone 1 we simply sum across row 1 – 10+2+9+18=39. To determine the number of trips to zone 1 we sum down the column 10+3+2+1=16. Since the number of trips originating in zone 1 is higher than that arriving at zone 1, we can assume that zone 1 is mostly residential. Whereas we can say that zone 4 is mostly offices or factories. Continue reading “Python, matrices, arrays, and the National Trip End Model”

The Macclesfield Canal

To Marple by train for the start/end of the Macclesfield canal.

The canal is notable for its lack of locks. Apart from a cluster of twelve between Congleton and Macclesfield, there is a single lock on the canal (lock 13); a stop lock at the junction between the Macclesfield canal and what was then the Hall Green Branch of the Trent and Mersey. The canal was built relatively late (1830) and by then the practice was to cluster locks, which was thought more efficient for travel than having to navigate isolated locks. Continue reading “The Macclesfield Canal”