[postgis-users] ST_AsRaster and pixeltype

Bborie Park bkpark at ucdavis.edu
Mon Nov 19 08:29:33 PST 2012


This would be a limitation on the datatypes supported by GDAL vs
PostGIS Raster.  GDAL does not have any data types smaller than 8BUI,
so any datatype smaller is treated as 8BUI.  8BSI also does not have
an equivalent in GDAL so is treated as 16BSI.

Feel free to file a ticket.  The only way to correct this is to add
another pass converting the output raster's pixel type from GDAL to
PostGIS Raster.

-bborie

On Mon, Nov 19, 2012 at 2:03 AM,  <Michael.Scholz at dlr.de> wrote:
> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkpark at ucdavis.edu


More information about the postgis-users mailing list