[postgis-devel] Rasteraddconstraints does not match raster2pgsql.py information

Bborie Park dustymugs at gmail.com
Fri Dec 9 07:23:10 PST 2011


On Fri, Dec 9, 2011 at 7:12 AM, Jose Carlos Martinez
<jomarlla at cgf.upv.es> wrote:
> Hi, Im a litte bit confused about the addrasterconstraints function (r8332
> version).
>
> Now after importing a raster with:
> raster2pgsql.py -r ASTGTM2_N39E002_dem.tif -t dem1 -k 200x200 -I -M -o
> dem1.sql
>
> This functions  is using still addrastercolumn what I think its gonna change
> soon. It gives me the following information:
>
> public.dem1.rast srid:-1 pixel_types:{16BSI} out_db:false
> regular_blocking:true nodata_values:NULL scale_x:'0.000277777777778'
> scale_y:'-0.000277777777778' blocksize_x:'200' blocksize_y:'200'
> extent:POLYGON((1.99986111111111 38.9998611111111,1.99986111111111
> 40.0001388888889,3.00013888888889 40.0001388888889,3.00013888888889
> 38.9998611111111,1.99986111111111 38.9998611111111))
>
> It does not fill the values in raster_columns (I guess this is because it
> was not updated to use addrasterconstraints).
>
> then I used:
> select addrasterconstraints ('dem1','rast');
>
> and it filled the values in raster_columns but they dont match the values
> got from raster2pgsql.py.
> I get raster_columns with:
>  r8332-1         | public         | dem1         | rast            |   -1 |
>         |         |         200 |         200 | t              | f
>      |         1 | {16BSI}     | {0}           |
> 010300000001000000050000002A3B4C5D6EFFFF3FB5814E1BE87843402A3B4C5D6EFFFF3F279E158D04004440B1E4174B7E710840279E158D04004440B1E4174B7E710840B5814E1BE87843402A3B4C5D6EFFFF3FB5814E1BE8784340
>
> The extent does not match with raster2pgsql values and it said the block is
> not regular when it is.
>
> Should I use addrasterconstraint specifying all the information in the
> arguments?, or im doing wroing?
>
> Cheers,
> Jose
>

Hey Jose,

If the extent constraint got applied correctly, the extent was
computed correctly (otherwise the constraint wouldn't be present for
the table).  Under the hood, the extent of the raster column is
computed using...

ST_ConvexHull(ST_Collect(ST_ConvexHull(rast)))

I don't know exactly what the method raster2pgsql.py uses to compute
the extent but it can be different.

As for the regular_blocking constraint, that is a purely informational
constraint (doesn't actually enforce anything) so out of an abundance
of caution is NOT automatically set by the software.  You can specify
that the raster column is regularly blocked by calling...

 select addrasterconstraints ('', 'dem1','rast', 'regular_blocking');

Otherwise, it looks like you're doing everything correctly.

-bborie



More information about the postgis-devel mailing list