Thanks Radim, I wasn't aware of all these news in trunk!
The QgsRasterPipe is really powerful.

Is there some doc about it?
I've run through the code to understand the logic behind QgsRasterPipe
(QRP) and QgsRasterInterface (QRI).
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?

giovanni

2012/12/11 Radim Blazek <[email protected]>

> On Tue, Dec 11, 2012 at 10:52 AM, G. Allegri <[email protected]> wrote:
> > Until now I've mostly created vector layers on QGIS, delegating raster
> > creation to custom GDAL utilities.
> > Recently I looked into QgsGdalProvider and I saw that it exposes the
> > QgsRasterDataProvider::Create capability.
> > I wonder if it's possible to create a brand new raster (geotiff or what
> > else) using this provider and, in case, what is the right workflow to do
> > that. I haven't found examples of doing it...
>
> Yes it is possible. You can use a provider directly
>
> QgsRasterDataProvider * provider = ( QgsRasterDataProvider*
> )QgsProviderRegistry::instance()->provider( "gdal", dataSource );
> provider->write( data, band, width, height, xOffset, yOffset )
>
> if you your algorithm implemented as QgsRasterInterface you can use
> higher level QgsRasterFileWriter which will do the work splitting
> raster into parts
>
> QgsRasterPipe* pipe = new QgsRasterPipe();
> pipe->set( inputProvider->clone() );
> pipe->insert( 1, yourInterface );
> QgsRasterFileWriter fileWriter( fileName );
> fileWriter.writeRaster( pipe, width, height, extent, crs );
>
> Radim
>
>
> > giovanni
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > [email protected]
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
>
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to