[postgis-users] Rasterize a vector

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue May 29 07:12:58 PDT 2012


There are more parameters to ST_AsRaster to align the raster you produce. You can align on an existing raster or provide all the parameters (scalex, scaley, gridx, gridy) to align it.

See http://postgis.refractions.net/documentation/manual-svn/RT_ST_AsRaster.html

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Paolo Cavallini
> Sent: Tuesday, May 29, 2012 9:42 AM
> To: PostGIS Users Discussion
> Subject: [postgis-users] Rasterize a vector
> 
> Hi all.
> I'm testing the ST_AsRaster command to convert a vector of adjacent polygons
> into a
> raster with different cell values according to one of the variables. I want the
> result to align to an existing raster. Sounds an easy task, but it is proving elusive.
> 
> create table rasterizzo6
>  as select id as rid,
>  St_asRaster(geom, 100, 100, '4BUI')
>  as rast from province;
> 
> creates a raster with irregular tiles, so it cannot be read by QGIS, and it is not
> aligned to an existing rasters.
> 
> Are there more detailed instructions available?
> Thanks.
> --
> Paolo Cavallini - Faunalia
> www.faunalia.eu
> Full contact details at www.faunalia.eu/pc
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list