[postgis-users] ST_AsRaster and pixeltype

Michael.Scholz at dlr.de Michael.Scholz at dlr.de
Mon Nov 19 02:03:58 PST 2012


Moin!
ST_AsRaster does not always create a raster with the specified pixel type. Instead of a band with 1BB I get one with 8BUI, which is the default according to the documentation. Example:
---------------------
CREATE TEMP TABLE foo (rid serial PRIMARY KEY, rast raster);

INSERT INTO foo (rast)
SELECT ST_AsRaster (ST_MakePolygon (ST_GeomFromText ('LINESTRING(604770 5793000, 604870 5793000, 604870 5792900, 604770 5793000)',32632)), 0.1, -0.1, '1BB', 1.0, 0.0);

SELECT AddRasterConstraints ('foo'::name,'rast'::name);

SELECT srid,scale_x,scale_y,num_bands,pixel_types,nodata_values
FROM raster_columns
WHERE r_table_name = 'foo';
---------------------
The result:
32632 | 0.10 | -0.1 | 1 | {8BUI} | {0}
If I specify 16BUI, I indeed get a 16BUI-band. Is this a special feature of ST_AsRaster or some limitation of GDAL?

My version:
"POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08 GDAL_DATA not found" LIBXML="2.7.8" RASTER"

Ciaoi, Michi


More information about the postgis-users mailing list