I have a raster table and a geometry table in postgis. My goal is to create a single raster merging elements from both:-
WITH geom_raster AS (
SELECT wkb_geometry, ST_AsRaster(wkb_geometry, 200,200,ARRAY['8BUI', '8BUI', '8BUI'], ARRAY[118,154,118], ARRAY[0,0,0]) as rast FROM geometry_table
),
raster AS (
SELECT ST_Union(rast) from raster_table,geom_raster where wkb_geomtry && rast
)
SELECT ............
What is the last step to merge the two into a single raster so I see the geometry on top of the raster? I tried ST_Union but get an error about alignment which I suspect means the grids or SRIDS or something else are not in unison?