[gdal-dev] Tiling with overlap

Antonio Falciano afalciano at yahoo.it
Mon Aug 8 08:03:45 PDT 2016


Il 08/08/2016 16:26, Ari Jolma ha scritto:
> 08.08.2016, 16:42, Margherita Di Leo kirjoitti:
>> Ari,
>>
>> On Mon, Aug 8, 2016 at 3:01 PM, Ari Jolma wrote:
>>
>>     08.08.2016, 15:19, Margherita Di Leo kirjoitti:
>>>     Dear all,
>>>
>>>     is there a simple way to create tiles with a certain overlap?
>>
>>     Do you mean by "overlap" the geographic area the tiles should
>>     cover? gdal2tiles.py creates the tiles for the area the source
>>     dataset covers. So you can control the area through the source
>>     dataset.
>>
>>
>> Thanks for your answer, sorry I'm not sure I understand the
>> methodology you are proposing. Let me explain what I'm trying to do so
>> that the problem is clearer. I have a dataset that is a global
>> coverage, e.g. GMTED [1]. That is a tiled dataset. However for my
>> processing chain I need tiles that overlap on each other for a certain
>> number of pixels. This means that the area at the border of each tile
>> should be covered by the tile itself and by the adjacent one to
>> certain extent.
>
> Ok. I've done similar thing when I needed to get overlapping tiles to
> produce shaded relief tiles on the fly from a DEM. My processing chain was:
>
> 1) define the wanted tile (rectangle)
> 2) expand it by some amount
> 3) grab the expanded tile from the source (GDAL Translate)
> 4) process the expanded tile (in my case DEMProcessing)
> 5) shrink the wanted tile
> 6) grab the original wanted tile from the result of the processing (GDAL
> Translate again)
> 7) deliver the final product
>
> (BTW, I'll present this in my FOSS4G 2016 talk)
>
> As the first thought I'd do the same access the source dataset with GDAL
> and grab the data as such rectangles as you need (not the native tiles
> on the server) - i.e., your overlapping tiles.
>
>> My method would be the following. I would create a virtual mosaic and
>> then create the tiles with this rule.  From the manual of
>> gdal2tiles.py it is not clear to me if i can obtain this result. What
>> do you mean by "you can control the area through the source dataset"?
>
> I mean simply set the area of the source but it is not relevant here
> since your problem is different.
>
> I think you need to write your own code as gdal2tiles is probably not
> the solution.

Hi all,
if we have calculated the tileindex with overlaps yet, a simple
approach could consist into restricting the desired cutline features
based on attribute query using gdalwarp. For instance:

gdalwarp -co COMPRESS=DEFLATE -co TILED=YES -cutline basilicata.shp 
-crop_to_cutline -overwrite -cwhere NOME_COM='Potenza' -dstnodata 
-99999.0 eu_dem_bas.vrt eu_dem_Potenza.tif

where, instead of NOME_COM you can use the tilename or simply an
incremental index. Writing a loop over the index should be the easy
part of the task. ;-) Hope this helps!

ciao
Antonio

-- 
Antonio Falciano
http://www.linkedin.com/in/antoniofalciano


More information about the gdal-dev mailing list