I'm looking to populate a large, empty Unsigned 8-bit raster with integer values 1 to 10. The value depends on the spatial relationship between a given raster cell and a variety of vector layers (points/lines/polygons) stored in PostGIS. I also have the vectors in shapefile and File GeoDatabase formats. Various fields and attributes within the vector layers need to be taken into account too.
Example: IF raster cell is 50m away from polygon A AND polygon A name = 'Alpha', THEN assign value of 3 to that raster cell. And repeat for all cells etc....
Bearing in mind the empty raster is 5x5m and covers the entire area of Great Britain (so billions of cells), and that the vector layers (30-40 or so) can contains 1000s of features each, what is the best way to populate the raster with values?
Raster details: -ot Byte -of GTiff -tr 5 5 -a_nodata 255
Example of the process I'm looking to repeat:
Note how this isn't simply a case of rasterizing vector layers, it's about the spatial relationship between multiple layers as well. See how the red dots, although small, actually affect a greater area proportionally than say, the blue polygon.