[postgis-devel] [raster] Tweaking overviews in raster2pgsql.py

Jorge Arévalo jorge.arevalo at deimos-space.com
Thu Dec 9 04:19:21 PST 2010


On Mon, Dec 6, 2010 at 7:06 PM, Mateusz Loskot <mateusz at loskot.net> wrote:
> *bump*
>
> On 02/12/10 18:06, Mateusz Loskot wrote:
>>
>> Hi,
>>
>> I'd like to propose a small simplification to the overviews management
>> in the raster loader script. Currently, raster2pgsql.py takes explicit
>> overview factor (called level, incorrectly in my opinion).
>> This follows gdaladdo appraoch where it accepts list of overview
>> reduction factors used to generate overview levels.
>>
>> I'd like to get rid of this explicit factors and simplify things a bit,
>> I'd like to follow the techniques users already know from slippy maps,
>> Google Maps, Oracle etc.
>>
>> The command would change from
>>
>> raster2pgsql.py -t mydata ... (base level)
>> raster2pgsql.py -t mydata -l 2 ...
>> raster2pgsql.py -t mydata -l 4 ...
>> raster2pgsql.py -t mydata -l 8 ...
>> ...
>>
>> The command would change to simple:
>>
>> raster2pgsql.py -t mydata -l 8 ...
>>
>> where the N=8 means that user requests 8 overview levels in total,
>> including base raster.
>> The levels are numbered as follows: 0, 1, 2, ..., N-1
>> The overview reduction factor is calculated based on level number:
>>
>> 2 ^ Ni
>>
>> where Ni is the actual level number:
>>
>> level=0 => overview factor=1 (base raster)
>> level=1 => overview factor=2 (reduction by 2)
>> level=2 => overview factor=4 (reduction by 4)
>> ... etc.
>>
>> This would generate overview tables named after overview level
>> but not overview factor. The latter is already stored in metadata.
>>
>> mydata (base raster)
>> mydata_o_1 (overview factor=2)
>> mydata_o_2 (overview factor=4)
>> mydata_o_3 (overview factor=8)
>> ...
>>
>> This calculation is reversible making it possible to calculate overview
>> level from given reduction factor:
>>
>> level = log(overview_factor) / log(2)
>> factor = pow(2, level)
>>
>> The simplification is that there is only *one* variable information
>> carried around, it is total number of overview levels.
>> All the rest values are easily calculated based on that.
>>
>>
>> What you say?
>>
>> Best regards,
>
>
> --
> Mateusz Loskot, http://mateusz.loskot.net
> Charter Member of OSGeo, http://osgeo.org
> Member of ACCU, http://accu.org
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>

Hello,

+1 for that. Is there any situation where you just want a specific
overview level, without the rest?

Best regards,

-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com



More information about the postgis-devel mailing list