Database Reference
In-Depth Information
SELECT
ST_AsRaster(
sf.geom, prism.rast,
ARRAY['8BUI', '8BUI', '8BUI',
'8BUI']::text[],
ARRAY[29, 194, 178,
255]::double precision[],
ARRAY[0, 0, 0, 0]::double
precision[]
)
FROM sfpoly sf
CROSS JOIN prism
WHERE prism.rid = 1;
Intheprecedingquery,weusetherastertileat rid = 1 asourreferenceraster.The
ST_AsRaster() function uses the reference raster's metadata to create the geo-
metry's raster. If the geometry and reference raster have different SRIDs, the geo-
metry is transformed to the same SRID before creating the raster.
How it works...
Inthisrecipe,weconvertedrasterstogeometries.Wealsocreatednewrastersfrom
geometries.Theabilitytoconvertbetweenrastersandgeometriesallowstheuseof
functions that would otherwise not be possible.
Search WWH ::




Custom Search