[Qgis-user] batch-saving raster files from QGIS
Torsten Lange
torsten.lange at mail.de
Tue Apr 28 04:23:36 PDT 2015
Hello,
I would like to batch-write some raster files from a project to one common folder using a script. This is my function:
def writeRaster(rasterObj, pathToFile, cols, rows, rasterExtentObj, rasterCRSObj):
provider = myRaster.dataProvider()
pipe = QgsRasterPipe()
pipe.set(provider.clone())
file_writer = QgsRasterFileWriter(pathToFile)
file_writer.writeRaster(pipe, cols, rows, rasterExtentObj, rasterCRSObj)
(Its a slightly modified example I found at nullege.com.)
For normal rasters this works just fine, but not for maps (scanned and georeferenced). The map colors are recoded to grey-values, as one could expect. Is there a way to keep the colors? From what I have seen, there is no parameter to handle this in a QgsRasterPipe().
Also, I remember once I tried to create a virtual raster cataloge using these maps. That failed because the maps used different color palettes. I guess they should be in RGB to create the vrt cataloge, shouldn't they?
Thanks for suggestions, Torsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150428/7ee95dff/attachment.html>
More information about the Qgis-user
mailing list