Re: What is the raster merge criteria algorithm on rasterio.merge?

James McBride

Hi Eduardo,
I'd suggest taking a look at the method argument that merge accepts. There are a few pre-defined methods, and you can also define your own function for selecting which pixel to select from the datasets to be merged. I copied the documentation below:

    method : str or callable
        pre-defined method:
            first: reverse painting
            last: paint valid new on top of existing
            min: pixel-wise min of existing and new
            max: pixel-wise max of existing and new
        or custom callable with signature:
        def function(old_data, new_data, old_nodata, new_nodata, index=None, roff=None, coff=None):
            old_data : array_like
                array to update with new_data
            new_data : array_like
                data to merge
                same shape as old_data
            old_nodata, new_data : array_like
                boolean masks where old/new data is nodata
                same shape as old_data
            index: int
                index of the current dataset within the merged dataset collection
            roff: int
                row offset in base array
            coff: int
                column offset in base array

Join to automatically receive all group messages.