Skip to content

Experimenting and visualising the OS Greenspace shape file in R and Python.

Notifications You must be signed in to change notification settings

David-Pugh/OS-GreenSpace-Cardiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OS-GreenSpace-Cardiff

Experimenting with the OS Greenspace maps.

You can explore the OS Greenspace maps in your browser at https://www.ordnancesurvey.co.uk/getoutside/greenspaces/ - a great way to see what open and green spaces are nearby and how you could create routes between them. OS Maps lets you find different places for leisure and recreation across England, Scotland and Wales.

In this code I play with the using the shapefiles from OS Greenspaces; overlaying them on geotiles to create my own bespoke maps using R, as well as interactive browser maps using Python and Folium/Leaflet.js and React.js and Deck.gl.

Access to the shapefiles is via OS at https://www.ordnancesurvey.co.uk/business-and-government/products/os-open-greenspace.html

Shapefile

The greenspace data from OS is available in Geography Markup Language GML and ESRI Shapefileformat. Both formats describe geographic features. I downloaded and used the Shapefile format - this is a digital vector storage format for storing geometric location and associated attribute information. The downloaded file consists of a readme, liscence information and the data in a subfolder. It consists of 3 mandatory files (shp, shx and dbf) along with a prj for the greenspace sites and also the access points for each site. These files need to be kept together.

  • .shp — shape format; the feature geometry itself
  • .shx — shape index format; a positional index of the feature geometry to allow seeking forwards and backwards quickly
  • .dbf — attribute format; columnar attributes for each shape, in dBase IV format
  • .prj — projection format; the coordinate system and projection information, a plain text file describing the projection

Viewing the Shapefile with QGIS

QGIS is a free and Open Source Geographic Information System. It allows you to create, edit, visualise, analyse and publish geospatial information on Windows, Mac, Linux and BSD. Its a great starting point to make sure the downloaded shapefile is ok and understand what it contains.

Create a new project withn QGIS and add a vector layer - select the .shp file and it will load the data. The Greenspace sites and access points can be loaded as seperate layers - the latter appearing as dots and the former as polygons. A snapshot of the greenspaces near Cardiff City Centre are shown below at a scale of 1:25000; if you are familiar with the areas you can see Bute Park alongside the River Taff (centre left) and Roath Park, Roath Rec and Waterloo Gardens stretching in a long strip (centre right). However, just the layers themselves are not that useful! Lets look at adding a map behind them using different technologies.

Greenspaces near Cardiff Centre as viewed in QGIS

Exploring the Shapefile with R

The concept is quite straightforward - go grab the appropriate base map and then plot the shapefile over the top of it as a set of polygons. This is a good start and gets static maps that you can eaily edit and customise. However there are a few potential trip points! See the visualising_in_r for details.

Exploring the Shapefile with Python and Foilum

A static file is good but lets create a more zoomable map with more information. For this we turn to Python and use the Folium package, which utilises the Leaflet JavaScript library.Take a look at the code at visualising in Python/Folium.

About

Experimenting and visualising the OS Greenspace shape file in R and Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published