Does anyone know a source from which to download vector UK Ordnance Survey grids at varying resolutions? Or failing that, a tool that can create an OS grid at a specified resolution? There are plenty of ways to generate a vector grid, but I've found no way of populating the attributes with OS grid references.
The 'National Grid Shape file' can be downloaded at: https://github.com/charlesroper/OSGB_Grids
Using this for a OS grid at a specific resolution would take some aggregation based on the TILE field, or by using the SCALE field.
From 29 January 2021, you can download a GeoPackage containing these grids at a number of resolutions (1, 5, 10, 20, 50, and 100 km) from Ordnance Survey's GitHub: https://github.com/OrdnanceSurvey/OS-British-National-Grids.
One alternative may be to populate the attributes yourself?
Provided that your generated grids are polygons rather than lines, you could use Easting and Northing figures to populate a field for each object.
There will obviously be some conversion of the numeric grid references to the OS Grid Ref, however there are plenty of example scripts out there to work from:
To answer this part of my question:
a tool that can create an OS grid at a specified resolution?
The following plugin for QGIS does the job nicely:
Specifically the OSGR Tool, which can generate British and Irish national grids for the whole of the British Isles or for a selected area within it, or indeed any international area.