I want to export/save a QGIS composition of raster/vector layers to a GEOTIFF or ECW raster with high resolution (20 000 * 20 000 Pixel).
9 Answers
Quantum GIS now supports this feature, the resolution can be set and can include an optional world file containing georeferencing information.
In the print composer check the "World file on" box under Export settings.
If you save the map canvas to a tif file, it will automagically be georeferenced. (A new, amazing feature in QGIS...). The resolution however will be the computer screen resolution. (96 dpi). So probably no more than 1900X1200 pixels.
-
can you please describe a little how to save the map canvas to a tif file? (using
img.save("pic.tif","tif")
) does not seem to do the trick for me– MasterPJCommented Sep 11, 2014 at 9:24 -
It's in the "File" menu, "Save as Image", then chosse tif as the format. QGis will automatically create a .tifw file.– til_bCommented Nov 1, 2014 at 14:42
Save a complete QGIS project, rasters and vectors, to a high-resolution GeoTIFF? I don't think you can do this (at present). What you can do is export high-res images from the print composer and then georeference them.
See this feature request: http://hub.qgis.org/issues/5840
Nick.
-
1There have been several requests for this feature (including mine on the old qgis forum in 2011 or so). Some of us use applications which use high-res georeferenced images as basemaps. It looks like it has been proposed and coded as a patch to 2.1: hub.qgis.org/issues/6985– scrussCommented Jul 31, 2013 at 18:48
I resolved the problem by applying MapServer's Shp2img.exe repeaetadly.
MapServer is able to render a qGis project, if the project gets first exported by the standard MapServer plugin to a *.map file. Subsequently it is possible to render the project to a image file (png, jpg, tif). Unfortunately there is a limit of - lets say more or less - 10000*10000 pixel.
But by writting some programming code, it is possible to manipulate the content of the *.map file and apply sequently the shp2img.exe to single tiles of the qGis project. In the last steps the single tile images can be merged using gdalbuildvrt and gdal_translate. As output an ECW or a GEOTIFF of huge size can be produced. I wrote a small tool to automatize the process and I could export a qGis view to ECW rasters with 100'000 * 100'000 pixel! I guess there is no restriction with higher resoulutions.
As precondition FWTools2.4.7 must be installed. FWTools2.4.7 contans MapServer and GDAL with ECW output support.
I wonder why the rester export of qGis views is not a standard feature of qGis... Is it really only me who wants to export a qGis view to a well used raster format (like ECW or GEOTIFF)???
Native solution to georeferenced raster (GeoTiff/png/jpeg) from the pretty QGIS composer.
Composition Tab - Export Settings - World file on [Map 0]
Voilà pretty composer raster is properly georeferenced.
-
This is not geotiff. It is a regular tiff, which only works for the desired objective if it has the world file with it.– rodrikevCommented Jul 5, 2017 at 13:38
The qGis 1.7.3 Plugin "MapServerExport" can produce a MapServer (*.map) file, containing your current composition of vector/raster layers. There is a new tool TopoMapCreator (http://sourceforge.net/p/topomapcreator) on SourceForge, that is doing the conversion from the MapServer (*.map) file to a raster file (*.ecw). The tool is based on Shp2img.exe of the MapServer. You are free to define the target resolution. So a raster file with huge resolution can be generated.
exporter = QgsLayoutExporter(layout) # not sure how you can assign an already made layout to this but I'm sure you can find somewhere
fn = os.path.splitext(output_file)[0] + "_renderedmap.tif"
settings = QgsLayoutExporter.ImageExportSettings()
settings.dpi = 1000
exporter.exportToImage(fn, settings)
but also just exporting as a GeoTiff from the print composer works too
This does not directly answer the question about how many pixels the resulting raster will have. However, under QGIS 3.26 Processing Toolbox > Raster Tools > Convert map to raster
you can export your map into a raster and specify Map units per pixel
. This is very useful to export a map composition in desired resolution.
You can use GeoPapatile plugin then use the "image.tif" output.
It is a tif with a tfw file, so it is georeferenced.