[Qgis-developer] Exporting a raster layer

Radim Blazek radim.blazek at gmail.com
Wed Jan 16 00:54:24 PST 2013


On Sun, Jan 13, 2013 at 5:52 PM, G. Allegri <giohappy at gmail.com> wrote:
> In Qgis master I think you could use QsgRasterFileWriter [1], for the raster
> providers which support writing,e.g. GDAL.

Yes, the QsgRasterFileWriter is higher level class for raster writing,
it is using lower level QgsRasterDataProvider::write(). Current
implementation of raster writing support was especially written for
"raster save as", it may appear that it has to be extended a bit to be
used as output of analytical tools.

The QsgRasterFileWriter is reading/writing in parts specified by
setMaxTileWidth(), setMaxTileHeight(). This mechanism could also be
used for data processing especially if an underlying module is not
optimized for large data sets (e.g. keeps all data in memory). OTOH,
it may cause problems on tile borders if an algorithm depends on
neighbour pixels in which case it would be necessary to process
tile+buffer, but the problem is to find the buffer size for each
module/options.

The QsgRasterFileWriter is reading data from QgsRasterPipe, from its
last QgsRasterInterface. However, it is also using some info from
original data source, for example original data type, so that it can
optimize output data type. Now it works just for saving of existing
rasters, probably we have to think it over again for use with
analytical tools.

The most obvious way to write raster from SEXTANTE using existing
support in core/providers would  be to implement QgsRasterInterface
representing SEXTANTE output. What do you think about that?

In which form are the data you need to write - format, file/memory,...?

It would be good to use also the same QgsRasterLayerSaveAsDialog used
for raster saving, but maybe it has too many options?

Radim

> AFAIK in Qgis 1.8 there's no mechanism to do that.
>
> giovanni
>
> [1] http://www.qgis.org/api/classQgsRasterFileWriter.html
>
> Sent from Nexus
>
> Il giorno 13/gen/2013 17:10, "Victor Olaya" <volayaf at gmail.com> ha scritto:
>
>> Hi all
>>
>> I have just implemented a new mechanism in SEXTANTE to make handling
>> of file formats more clear and easy. Now, no matter what provider is
>> creating a vector layer, all formats supported by QGIS can be
>> selected, without requiring anything special added to the algorithm
>> provider. SEXTANTE takes care of converting if needed.
>>
>> I want to implement the same thing for raster layers, but I do not
>> know how to export a raster layer into a given format (except by
>> calling GDAL translate), and I need it for that.. Can any one give me
>> an idea or point me to some code to do that?
>>
>> Thanks in advance!
>>
>> Victor
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>


More information about the Qgis-developer mailing list