[gdal-dev] cutting up large TIFF files with gdal_translate - Solution

Zoltan Szecsei zoltans at geograph.co.za
Wed Aug 22 09:45:43 PDT 2012


Hi Frank,
Thanks for the prompt reply and explanation.

Kind regards,
Zoltan


On 2012/08/22 18:43, Frank Warmerdam wrote:
> On Wed, Aug 22, 2012 at 9:38 AM, Zoltan Szecsei <zoltans at geograph.co.za> wrote:
>> Hi,
>> I have a large image bounded by:
>>
>> Upper Left  (  447007.599, 7132849.501) ( 32d28'15.03"E, 25d55'19.12"S)
>> Lower Left  (  447007.599, 7127851.511) ( 32d28'14.30"E, 25d58' 1.59"S)
>> Upper Right (  451005.901, 7132849.501) ( 32d30'38.75"E, 25d55'19.63"S)
>> Lower Right (  451005.901, 7127851.511) ( 32d30'38.08"E, 25d58' 2.10"S)
>>
>> and I would like to cut it up into 1Km squares starting on the 447000
>> 7133000 boundary.
>> The problem is that using:
>> gdal_translate -of JPEG -projwin $tlx $tly $brx $bry  m_36s.tif
>> m_36s_${r}${c}.jpg
>>
>> gives me:
>> Computed -srcwin -152 97030 20008 20008 from projected window.
>> Computed -srcwin falls outside raster size of 79999x100001.
>>
>> Whilst the error is understandible, I was hoping that extra pixels would be
>> automatically inserted as no_data values to make up my 1km tiles.
> Zoltan,
>
> Unfortunately gdal_translate does not support this.  Instead I'd
> suggest using gdalwarp:
>
>    gdalwarp -te xmin ymin xmax ymax srcfile dstfile
>
> The "target extent" window may be off the source image without
> problem.
>
>> I'm not sure if -outsize will help me or not.
>> (ie: I first increase the area of my original tiff image so that it is
>> larger than my required tiles, and then cut it up as above)
> The -outsize makes the output larger (or smaller) by replication
> or decimation not by growing the extents.
>
> Best regards,
> Frank
>
>> Is this the function of -outsize ?
>>
>> Any suggestions how I should go about this issue?
>>
>> Thanks & regards,
>> Zoltan
>>
>>
>>
>> --
>>
>> ===========================================
>> Zoltan Szecsei PrGISc [PGP0031]
>> Geograph (Pty) Ltd.
>> P.O. Box 7, Muizenberg 7950, South Africa.
>>
>> 65 Main Road, Muizenberg 7945
>> Western Cape, South Africa.
>>
>> 34° 6'16.35"S 18°28'5.62"E
>>
>> Tel: +27-21-7884897  Mobile: +27-83-6004028
>> Fax: +27-86-6115323     www.geograph.co.za
>> ===========================================
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>


-- 

===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
P.O. Box 7, Muizenberg 7950, South Africa.

65 Main Road, Muizenberg 7945
Western Cape, South Africa.

34° 6'16.35"S 18°28'5.62"E

Tel: +27-21-7884897  Mobile: +27-83-6004028
Fax: +27-86-6115323     www.geograph.co.za
===========================================



More information about the gdal-dev mailing list