gdalwarp for tiling rasters (was: showing 2 landsat utm geotiff)
Jan Hartmann
j.l.h.hartmann at UVA.NL
Thu Oct 7 06:54:38 PDT 2004
joerg p wrote:
> hello,
> I downloaded several overlapping europe etm+ mosaics, reprojected them
> to geo. Each file is around 1.2 GB. For better performance I know I
> have to tile them and build overviews.
> To tile and remove the overlapping, i would like to first combine all
> images and then to tile them.
> It's gonna be a really huge file during this process, around 18 GB,
> does this work?
> Could someone give me an example of this gdal combine command? I can't
> find it.
> How many overview steps should I build, is there a rule of thumb?
You can use gdalwarp to create tiles from many input files without
combining these first into one huge file. The thing to remember is that
gdalwarp can warp *into* an existing output file. In that case, all
settings of that file (extent, pixel size, projection etc) are
conserved, and the content of the input file is copied to the
appropriate locations. Gdalwarp does not need to read complete rasters
into memory, so you can tile as large a region as you wish.
So if you use the following gdalwarp parameters
-te xmin ymin xmax ymax
-tr xres yres
you can create as many tiles as you like and fill them with the input
files. A brute force method would be to warp all input files into all
output files; a somewhat more clever one would be to check for the
extent of the input files first and only warp them into the relevant
output tiles.
As to the number of overviews: my simple rule of thumb is to resample in
factors of two: a 10000*10000 raster gets overviews at 5000*5000,
2500*2500, 1250*1250 and 625*625. There should be no need to go below
that. I tile all files in tiles of 2000*2000, although this number is
perhaps a bit too small. I would appreciate to hear from others how they
do this.
Perhaps this functionality of gdalwarp could be explained a bit more in
detail in the manual page. For now it only says: "Mosaicing into an
existing output file is supported if the output file already exists".
This is really a very important and powerful aspect of the program and
it is very easy to overlook this line. At least that is what I did for a
considerable length of time.
Jan
More information about the MapServer-users
mailing list