I can rasterise a vector layer, but I'm having trouble mapping it to a reference raster.
The reference raster, called dummy_rast is a 1x1 raster tile with a height and width of 500pixels, each of 250m in size. I created using a pl/pgsql function: SELECT make_tiled_raster('public', 'dummy_rast', 576000, -3780000, 1, 1, 500, 500, 250, -250); The result is srid | scale_x | scale_y | blocksize_x | blocksize_y | num_bands | pixel_types | nodata_values ------+---------+---------+-------------+-------------+-----------+-------------+--------------- 3577 | 250 | -250 | 500 | 500 | 1 | {8BUI} | {NULL} I now wish to burn a vector layer onto this raster: CREATE TABLE viewshed_rast AS WITH vt as (SELECT ST_Union(geometry) as geometry FROM viewshed_vectors) SELECT rt.rid, ST_AsRaster(vt.geometry, rt.rast, '8BUI', 120, 100) as rast FROM dummy_rast as rt, vt; The result is srid | scale_x | scale_y | blocksize_x | blocksize_y | num_bands | pixel_types | nodata_values ------+---------+---------+-------------+-------------+-----------+-------------+--------------- 3577 | 250 | -250 | 67 | 38 | 1 | {8BUI} | {100} (1 row) I do not understand why the resultant raster does not map to the reference raster? Refer screenshot attached showing the resultant layers in QGIS. The upperleftx and upperlefty, and the block size of the resultant raster are defined by the extent of the vector layer and not the reference raster. Is there something obvious I'm doing wrong? Thanks.
<<attachment: Screen shot 2012-06-24 at 3.54.12 PM.png>>
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users