[gdal-dev] Re: How to divide a raster layer into a set of tiles
Nathan Vander Wilt
nate-lists at calftrail.com
Thu Mar 25 16:34:20 EDT 2010
On Mar 23, 2010, at 5:22 PM, Eli Adam wrote:
> Gilles,
> I do a similar process (build large vrt mosaic, reproject the
> mosaic vrt to another vrt, tile the reprojected mosaic vrt in new
> projection to tif) although my end tiles are in tif and not compressed.
> My method is the brute force way and not elegant at all. You may also
> want to know that I have been advised
> (http://news.gmane.org/gmane.comp.gis.gdal.devel) that this is very
> inefficient and pushing the VRT format. Steps 1 and 2 are the same as
> you describe.
For those following along at home, the link to that thread is http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023195.html
> 1) create a single GDAL layer from all initial tiles with gdalbuildvrt
> 2) reproject this virtual raster with gdalwarp (outputs a new .vrt)
> 3) Tile it with gdal_translate: gdal_translate -projwin 7288440 446648
> 7306569 429923 mosaicvrtprj.vrt tile1.tif
If you need tiles in a typical form (standard web tile map, geographic/ECE, or original projection) you can combine steps 2 and 3 using gdal2tiles.py which works with the VRT source built in step 1. (It uses gdalwarp functions internally to build a similar VRT as step 2, and automatically implements standard tiling instead of the manual calculations in step 3.)
I can't confirm that the process is much slower with a VRT source. A large sample image that took 4m36s as a single file took 4m42s when chopped into 4 tiles and recombined via a VRT. This may scale differently for a larger number of tiles, but considering it took 1m14s for gdal_merge.py to make a new real image (versus 0m2s for gdalbuildvrt), it's a significant GAIN for this small sample.
hope this helps,
-natevw
http://calftrail.com
More information about the gdal-dev
mailing list