[gdal-dev] gdalwarp vs gdal_translate for scaling

Michael Sumner mdsumner at gmail.com
Thu Jan 5 15:55:58 PST 2023


ugh, sorry just realized my comment (sentence begins 'Further ...') about
"scaling" is completely irrelevant - you mean spatial and not data scaling.
Just ignore that one sentence.

Cheers, Mike



On Fri, Jan 6, 2023 at 10:36 AM Michael Sumner <mdsumner at gmail.com> wrote:

> in short, warp will give you exactly the target extent of a (possibly) new
> grid specification in that -te subdivided by the -ts.
>
> translate will give you approximately the extent provided to projwin, but
> snapped to the source grid alignment at a particular zoom implied by the
> projwin subdivided by the outsize.
>
> Further, translate can do scaling but warp cannot, which I guess is why
> you have a vrt in the workflow - you can scale a source virtually with
> translate to vrt, then warp (or translate) that.
>
> (Finally it's a bit sloppy to have such arbitrary extent values that warp
> will preserve and I routinely snap them to the source alignment, and I'm
> interested to provide such a feature in the warper options too.)
>
> Hope that helps!
>
>
>
>
>
>
> On Fri, 6 Jan 2023, 03:16 Daniel Mannarino, <daniel.mannarino at gmail.com>
> wrote:
>
>> Hi folks!
>>
>>
>>
>> We have a process that generates web mercator zoom levels by resampling
>> from the next higher up, from the original resolution down to zoom level 0.
>> Currently we do so with gdalwarp, but a team member realized that
>> gdal_translate is capable of the same, and at first glance is much faster.
>> Unfortunately, using the two commands (below) which I intended to do
>> exactly the same thing winds up with slightly different results (can/should
>> I post a small image here to illustrate?).
>>
>> I won't ask "Which is correct?" because the answer is almost certainly
>> "That depends on what you want". But can someone help me understand the
>> difference between what is done with the gdalwarp command versus the
>> gdal_translate one so that I can decide if using gdal_translate is an
>> acceptable solution? Here are the two commands:
>>
>>
>>
>> gdalwarp -te 12523442.714243278 0.0 15028131.257091936 2504688.5428798534
>> -ts 65536 65536 -r mode -co TILED=YES ../source_tiles/everything.vrt
>> 007R_013C_warp_mode.tif
>>
>>
>>
>> gdal_translate -r mode -projwin 12523442.714243278 2504688.5428798534
>> 15028131.257091936 0.0 -outsize 65536 65536 -co TILED=YES
>> ../source_tiles/everything.vrt 007R_013C_translate_mode.tif
>>
>>
>>
>> Thank you!
>>
>> Daniel Mannarino
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>

-- 
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230106/4db71598/attachment-0001.htm>


More information about the gdal-dev mailing list