[gdal-dev] gdal_translate of VRT file with overlapping files. Target pixel value selection.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] gdal_translate of VRT file with overlapping files. Target pixel value selection.

Christoph Paulik
Hi,

We have a VRT file in which some regions overlap. As far as I can tell
a gdal_translate of the VRT into a GTIFF just takes the value of the
first file it encounters for a given target pixel.

Is there a way to specify an averaging method for such cases e.g. take
the mean, max, min etc.?
If not possible yet would that be a feature that would be of interest?

Cheers,
Christoph

--
Christoph Paulik // Head of Infrastructure
VanderSat // Satellite observed water data. Globally. Daily.
Wilhelminastraat 43a, 2011 VK, Haarlem (NL), The Netherlands
M  +31 6 18271928 W  www.vandersat.com

--------------------------------------------------------------------------------------
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: gdal_translate of VRT file with overlapping files. Target pixel value selection.

Even Rouault-2
On vendredi 25 janvier 2019 14:36:23 CET Christoph Paulik wrote:
> Hi,
>
> We have a VRT file in which some regions overlap. As far as I can tell
> a gdal_translate of the VRT into a GTIFF just takes the value of the
> first file it encounters for a given target pixel.

Actually, this will be the value of the last (as ordered in the VRT) source
that covers the target pixel.

>
> Is there a way to specify an averaging method for such cases e.g. take
> the mean, max, min etc.?
> If not possible yet would that be a feature that would be of interest?

You could do that in two steps:
- for each source, create a VRT from it whose extent is the union of the
extents, and set a nodata value.
- and then create a VRT of thoses VRT using a derived band:
https://www.gdal.org/gdal_vrttut.html#gdal_vrttut_derived_c
The existing default pixel functions do not cover your need, so you could use
instead a pixel function written in Python:
https://www.gdal.org/gdal_vrttut.html#gdal_vrttut_derived_python

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev