I have two non-overlapping rasters, A (red hues) and B (blue hues). I want to change the value of pixels in B via a nearest-neighbor search in A; i.e. a pixel in B with a value of 15 looks for the nearest pixel in A, finds a nearby A pixel with a value of 30, then the pixel in B changes from 15 to 30.

I can do this by converting both rasters to points and using distance matrix and joins as in Joining attributes from nearest point in QGIS?, but it's slow and kind of cumbersome; is there an all-raster way to do this in QGIS?


  • I think you'll have to convert red to points anyway. Next step do eucledian allocation to these points. Con(~IsNull("blue"),"allocation)). Use lookup to convert results into floats.
    – FelixIP
    Mar 22, 2016 at 23:45
  • That worked great in Arc, didn't even have to convert to points first, just fed Euclidian Allocation raster A and it gave a delauney triangulation raster. Then the Con statement in raster calculator to re-assign B's pixels. Took 5 minutes to run Euclidian Allocation though, so hoping QGIS/GDAL can do it faster. Mar 23, 2016 at 5:19
  • So they store integers. Makes a difference
    – FelixIP
    Mar 23, 2016 at 6:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.