I wrote a script to do something like this at one point, though I can&#39;t find it now.  It was intended for terrain, but could be used per band on imagery.  It used r.buffer to create a distance gradient and then r.recode to convert this gradient to a percentage.  I then used r.mapcalc to merge the 2 rasters based on the percentage.<div>
<br></div><div>The script automated the buffer distances and the creation of the recode.txt file, but went something like this:</div><div><div><br></div><div>## make a null raster</div><div>r.mapcalc &quot;temp_null = if(isnull(source),1,null)&quot;</div>
<div><br></div><div>## create a distance gradient from the null raster.  The output will have int values 1-7 where 1 equals the input null raster</div><div>r.buffer in=temp_null out=temp_buf distances=10,20,30,40,50,60 units=meters</div>
<div><br></div><div>## fill nulls in the distance gradient with 0 for recoding</div><div>r.mapcalc &quot;temp_buf_fill=if(isnull(temp_buf),0,temp_buf)&quot;</div><div><br></div><div>## recode to a percentage</div><div>r.recode in=temp_buf_fill out=temp_recode rules=recode.txt</div>
<div><br></div><div>where recode.txt would have the range from temp_buf_fill expressed as percentages:</div><div>1:1:100:100</div><div>2:2:86:86</div><div>3:3:71:71</div><div>4:4:57:57</div><div>5:5:43:43</div><div>6:6:29:29</div>
<div>7:7:14:14</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">0:0:0:0</div><div><br></div><div>## merge the output</div><div>r.mapcalc &quot;merged=if(isnull(source),patch,(patch*(temp_recode/100.0))+(source*(1.0-(temp_recode/100.0))))&quot;</div>
<div><br></div><div>Sorry if that doesn&#39;t work, but hopefully you get the idea.</div><div><br></div><div>- Jamie</div><div><br><div class="gmail_quote">On Thu, Feb 24, 2011 at 10:53 AM, kaipi <span dir="ltr">&lt;<a href="mailto:mapcollect@gmx.net">mapcollect@gmx.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
I need to patch rasters containing NULL areas with alternative rasters. I can<br>
do this with r.patch but due to different quality/resolution of the rasters<br>
this produces prominent seamlines. Is there a way to feather/blend between<br>
merged rasters using Grass GIS?<br>
<br>
Thanks,<br>
<br>
Kaipi<br>
<font color="#888888">--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6061489.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6061489.html</a><br>

Sent from the Grass - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</font></blockquote></div><br></div></div>