1

I'm attempting to use the minimum operator with gdalwarp v2.1.0 but it always mosaics as if I had selected nearest neighbor.

From the docs:

-r resampling_method:
min:  minimum resampling, selects the minimum value from all non-NODATA contributing pixels. (GDAL >= 2.0.0)

The command is staightforward:

gdalwarp.exe -r min -srcnodata -9999 -dstnodata -9999 a.tif b.tif ... z.tif output.tif

But it gives me this output:

gdalwarp with minimum resampling - no effect

When what I expect is this (mosaicked through ArcMap with the minimum operator):

ArcMap's mosaic to new raster with minimum operator - expected output

This totally looks like a bug to me but I figured I'd ask here first in case I'm missing something.

1

I believe that gdalwarp does not handle multiple input files as a stack but it is processing them one by one so that the first image is warped into the target file first and pixels from the second one is added to the same target. If new pixels overlap existing ones they will simply be overwritten and the pixels from the last image will win the whole game.

The resampling options are applied to each image individually. "Contributing pixels" do not mean all contributing pixels from all the input files but contributing pixels from a.tif, then from b.tif and so on.

min: minimum resampling, selects the minimum value from all non-NODATA contributing pixels. (GDAL >= 2.0.0)

  • Interesting, if that's the intended behavior then it's a little counter-intuitive, doesn't seem like that'd be very useful. I wonder if first stacking them as bands in a VRT would do it, then. I'll have to experiment more and report back. In the meantime I modified gdal_merge.py to suit my purposes. – mikewatt Jul 20 '17 at 21:09
  • Even if you warp just a single image several pixels are usually contributing and if you increase pixel size by the same then several pixels for sure contribute and depending on the data and use case using the min option may well be useful. For more advanced mosaicing you could have a look at OSSIM which should be able to do feathering and other nice things. – user30184 Jul 20 '17 at 21:23
  • Good point, I suppose my mistake was assuming it was analogous to ArcMap's mosaicking operation. It is a resampling option, after all, not a blending one. OSSIM looks like it has some great utilities, not sure how I've missed that package. Cheers – mikewatt Jul 21 '17 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.