[Gdal-dev] create 256x256 tiles for google maps
Jan Hartmann
j.l.h.hartmann at uva.nl
Fri Apr 6 05:02:52 EDT 2007
Markus Neteler wrote:
> On Thu, Apr 05, 2007 at 09:43:57PM +0200, Mateusz Loskot wrote:
>> Paul Van Deusen napisa?(a):
>>> I am using imagemagick to crop a geotiff file into 256x256 gif files to
>>> serve as tiles for google maps.
>>> However, it starts to choke once the tiff file gets larger than 1/2
>>> GB. Can gdal_translate take
>>> a tif file and split it into individual tile files of a specific size?
>> Paul,
>>
>> AFAIK, GDAL won't help here out of the box.
>> Users usually take gdal_translate.cpp program and customize it to do this
>> job.
>> Here you can find such utility called gdalsplit and posted to the list a
>> longer while ago:
>>
>> http://lists.maptools.org/pipermail/gdal-dev/2004-September/004135.html
>>
>> May be it will work for you.
>
> If anyone happens to haave an updated version of "gdalsplit"
> I would be interested.
> Maybe some mechanism to manage user contributions would be
> good (like the GRASS Addons repository).
>
> Markus
>
> ------------------
> ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
> ITC -> since 1 March 2007 Fondazione Bruno Kessler
> ------------------
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>
Perhaps I am overlooking something, or didn't understand the question
right, but I regularly create tiles from a large tif-file with the
-srcwin <xoff yoff xsize ysize> parameter of gdal_translate. A simple
bash-script to tile in.tif (30000*30000 pixels) into 256*256 tiles would be:
width=30000
height=30000
y=0
while [ $y -lt $height ]
do
x=0
while [ $x -lt $width ]
do
outtif=t_${y}_$x.tif
gdal_translate -srcwin $x $y 256 256 in.tif $outtif
let x=$x+256
done
let y=$y+256
done
This would result in about 14000 files. This is so simple that it can
even be done with a primitive DOS batch file.
Most of the time I work with projected coordinates (-projwin instead of
-srcwin) but the idea is the same. Note by the way that -projwin uses
the *upper* left corner as reference.
Jan
Dr. J. Hartmann
Department of Geography
University of Amsterdam
More information about the Gdal-dev
mailing list