[postgis-users] Large leading blanks spaces in geometry column

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Oct 11 07:54:55 PDT 2011


> Sorry, there are a lot of things i don't understand like :
> 1) how can i use ST_AsText, ST_AsEWKT, or ST_AsEWKB to get the geometry
> colum for raster column ?

If you want the raster footprint always cast the raster to a geometry like this rast::geometry before using those functions. This is equivalent to ST_ConvexHull(rast).

If you want to vectorize the raster into all its shared pixel value parts do ST_DumpAsPolygons(rast).
 
> 2) what are the leading blank spaces ? because after i remove the blanks and
> create a raster column which this command :
> 
> INSERT INTO dummy_rast(rid, rast)
> postgisdata-# VALUES
> (1,('01'||'0000'||'0000'||'0000000000000040'||'0000000000000840'||'000000
> 000000E03F'||'000000000000E03F'||'0000000000000000'||'000000000000000
> 0'||'00000000'||'0A00'||'1400')::raster),
> postgisdata-#
> (2,('01000003009A9999999999A93F9A9999999999A9BF000000E02B274A'||'410
> 00000007719564100000000000000000000000000000000FFFFFFFF05000500040
> 0FDFEFDFEFEFDFEFEFDF9FAFEF'||'EFCF9FBFDFEFEFDFCFAFEFEFE04004E627AAD
> D16076B4F9FE6370A9F5FE59637AB0E54F58617087040046566487A1506CA2E3F
> A5A6CAFFBFE4D566DA4CB3E454C5665')::raster);
> 
> i have no error ! good , but if i run :
> SELECT rid, Box2D(rast) As rastbox FROM dummyrast; i got :
> NOTICE: compute_serialized_box3d called on unknown type 0
> ERROR: lwgeom_size called with unknown-typed serialized geometry

Again Box2D(rast) is not possible. You should use ST_MakeEmptyRaster() and ST_AddBand() to create new rasters and add bands to them.

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

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

Pierre



More information about the postgis-users mailing list