[postgis-tickets] [PostGIS] #2832: [raster] raster2pgsql pads overviews with single tiles
PostGIS
trac at osgeo.org
Wed Jul 9 04:46:33 PDT 2014
#2832: [raster] raster2pgsql pads overviews with single tiles
--------------------+-------------------------------------------------------
Reporter: strk | Owner: dustymugs
Type: defect | Status: new
Priority: medium | Milestone:
Component: raster | Version: trunk
Keywords: |
--------------------+-------------------------------------------------------
I'm importing
https://github.com/mapnik/mapnik/blob/v2.2.0/tests/data/raster/dataraster.tif
with overviews 4 and 16 using raster2pgsql, requesting no padding:
{{{
raster2pgsql -l 4,16 -t 256x256 dataraster.tif dataraster
}}}
The import results in 3 tables: dataraster (72 rows), o_4_dataraster (6
rows), o_16_dataraster (1 row).
While the o_4_dataraster tiles are correctly NOT padded, the
o_16_dataraster tile is instead fully padded.
So we have, for o_4_dataraster:
{{{
mapnik-tmp-pgraster-test-db=# select st_summary(rast) from o_4_dataraster;
st_summary
---------------------------------------------------------------------------------------
Raster of 256x256 pixels has 1 band and extent of BOX(-14637
4347678,497363 4859678) +
band 1 of pixtype 16BSI is in-db with NODATA value of -999
Raster of 256x256 pixels has 1 band and extent of BOX(497363
4347678,1009363 4859678)+
band 1 of pixtype 16BSI is in-db with NODATA value of -999
Raster of 59x256 pixels has 1 band and extent of BOX(1009363
4347678,1127363 4859678)+
band 1 of pixtype 16BSI is in-db with NODATA value of -999
Raster of 256x222 pixels has 1 band and extent of BOX(-14637
3903678,497363 4347678) +
band 1 of pixtype 16BSI is in-db with NODATA value of -999
Raster of 256x222 pixels has 1 band and extent of BOX(497363
3903678,1009363 4347678)+
band 1 of pixtype 16BSI is in-db with NODATA value of -999
Raster of 59x222 pixels has 1 band and extent of BOX(1009363
3903678,1127363 4347678)+
band 1 of pixtype 16BSI is in-db with NODATA value of -999
(6 rows)
}}}
And for o_16_dataraster:
{{{
mapnik-tmp-pgraster-test-db=# select st_summary(rast) from
o_16_dataraster;
st_summary
---------------------------------------------------------------------------------------
Raster of 256x256 pixels has 1 band and extent of BOX(-14637
2811678,2033363 4859678)+
band 1 of pixtype 16BSI is in-db with NODATA value of -999
(1 row)
}}}
The problem with the padding is that the extent of the overview with
factor 16 is a lot larger than the original extent:
{{{
mapnik-tmp-pgraster-test-db=# select 'orig' as l,
st_extent(rast::geometry) from dataraster union all select 'ov_4',
st_extent(rast::geometry) from o_4_dataraster union all select 'o_16',
st_extent(rast::geometry) from o_16_dataraster;
l | st_extent
------+-------------------------------------
orig | BOX(-14637 3903178,1126863 4859678)
ov_4 | BOX(-14637 3903678,1127363 4859678)
o_16 | BOX(-14637 2811678,2033363 4859678)
(3 rows)
}}}
That is, the extent of overview 16 covers almost 4 times the area of the
original geometry, while the extent of overview 4 is almost the same:
{{{
mapnik-tmp-pgraster-test-db=# with p as ( select ( select
st_extent(rast::geometry) from dataraster ) as orig, ( select
st_extent(rast::geometry) from o_4_dataraster ) as o4, ( select
st_extent(rast::geometry) from o_16_dataraster ) o16 ) select
st_area(o4)/st_area(orig) as o4f, st_area(o16)/st_area(orig) as o16f from
p;
-[ RECORD 1 ]-----------
o4f | 0.999915052025483
o16f | 3.84148387396651
}}}
I'm actually also surprised to see that the area of extent for overview 4
is even slightly smaller than the area of the original extent.
Anyway, this ticket is for the forced padding in the single-tile overview.
I hadn't tried with versions less than 2.2.0dev
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2832>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list