Thanks Radim, I wasn't aware of all these news in trunk!<div>The QgsRasterPipe is really powerful.</div><div><br></div><div>Is there some doc about it?</div><div>I've run through the code to understand the logic behind QgsRasterPipe (QRP) and QgsRasterInterface (QRI).</div>
<div>I see that for a QRI must be set a an input QRI (setInput method). If I understand it correctly a QRP can have various "branches" made by sequences of QRI?</div><div><br></div><div>giovanni<br><br><div class="gmail_quote">
2012/12/11 Radim Blazek <span dir="ltr"><<a href="mailto:radim.blazek@gmail.com" target="_blank">radim.blazek@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Tue, Dec 11, 2012 at 10:52 AM, G. Allegri <<a href="mailto:giohappy@gmail.com">giohappy@gmail.com</a>> wrote:<br>
> Until now I've mostly created vector layers on QGIS, delegating raster<br>
> creation to custom GDAL utilities.<br>
> Recently I looked into QgsGdalProvider and I saw that it exposes the<br>
> QgsRasterDataProvider::Create capability.<br>
> I wonder if it's possible to create a brand new raster (geotiff or what<br>
> else) using this provider and, in case, what is the right workflow to do<br>
> that. I haven't found examples of doing it...<br>
<br>
</div></div>Yes it is possible. You can use a provider directly<br>
<br>
QgsRasterDataProvider * provider = ( QgsRasterDataProvider*<br>
)QgsProviderRegistry::instance()->provider( "gdal", dataSource );<br>
provider->write( data, band, width, height, xOffset, yOffset )<br>
<br>
if you your algorithm implemented as QgsRasterInterface you can use<br>
higher level QgsRasterFileWriter which will do the work splitting<br>
raster into parts<br>
<br>
QgsRasterPipe* pipe = new QgsRasterPipe();<br>
pipe->set( inputProvider->clone() );<br>
pipe->insert( 1, yourInterface );<br>
QgsRasterFileWriter fileWriter( fileName );<br>
fileWriter.writeRaster( pipe, width, height, extent, crs );<br>
<br>
Radim<br>
<br>
<br>
> giovanni<br>
><br>
> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
><br>
</blockquote></div><br></div>