5

Is there a method to save a map in raster format from QGIS using compression?

For exemple from "Export map" in ArcGIS there are many options to compress the images depending on the file type (tiff, jpg, etc.).

I need to export/save a raster from a vector data (shape), and specifically I need to export an atlas.

6
  • 1
    Right-click raster > save as. In the resulting dialog box you can choose the Format, and down under create options you can choose a profile which may have various compression options depending on the format chosen. Is this what you're looking for?
    – Chris W
    Nov 26 '14 at 21:22
  • Throw in a few screen shots @ChrisW and that's an answer I could vote for. That exports the individual raster which is the same as ArcMap right click on raster layer and select Data::Export Data. What I think they want is (in QGIS) select Project::Save as Image then select jpeg in the type. You can't control the compression settings on this dialog. Nov 26 '14 at 21:42
  • 1
    @MichaelMiles-Stimson Then that's a very good clarifying question. toWGS84, are you wanting to save/work with raster data or simply export your map as an image file?
    – Chris W
    Nov 26 '14 at 21:48
  • I think cover both @ChrisW, it's not exactly clear from the question but I'd be leaning toward the 2nd (export entire view as image showing all layers). I'm downloading the newest version now just to check if the compression settings are available in the new version. Nov 26 '14 at 22:05
  • 1
    Ok, having downloaded and installed the latest version (2.6.0 Brighton) I can confirm that there are no compression settings in the Project::Save as Image dialog. Some image formats save with compression by default like PNG and JPG/JPEG so I think they're your only option for compressed output. If you choose Tif/Tiff it will be saved uncompressed with no ability to select a compression method; you can however use GDAL_Translate to convert the uncompressed output into a compressed image, this utility is installed with QGIS (in the bin folder on windows). Nov 26 '14 at 22:32
8

I would not normally jump in when a question has effectively been answered in the comments but it seems some confusion has crept in.

If you want to export your raster as is but with compression there are lots of ways of doing it but Project->Save as Image is NOT one of them. This takes a georeferenced snapshot of the current data view, which can be useful but is not what you want (based on the question title). It will save as JPEG, which is a compressed format, but there is no control over the level of compression. Likewise you can save a map from the composer as a JPEG, but, apart from resolution, there is no control over the compression level.

To compress a raster, you can tell QGIS to use compression in almost any of dialogs generating raster outputs. The "Save as" option mentioned in Chris W's comment is one such. Right-click on the raster layer to get a pop-up menu. The Save as dialog looks as follows:

enter image description here

You can find similar creation options in many raster-related dialog boxes (e.g. Raster->Conversion->Translate which would be another route to do this same thing). Have a look here for some of the other creation options you can specify. Note, QGIS should detect the current extent and resolution etc of your raster automatically, so you can just leave those options alone (unless you want to also change the file size by down-sampling the data of course).

Even where you don't have a handy button for a function like compression, if you see a little yellow pencil icon next to the box showing the GDAL commandline, then you can edit the command and (where GDAL allows it) add creation options with the -co flag. Below is an example of editing the GDAL commandline to include compression for Raster->Projection->Warp. You will need to look up the documentation on what these are in each case but for look here for gdalwarp. There are loads of other options besides the -co flag and getting to know the GDAL commands will make QGIS dialogs even more powerful because editing the commandline in this way gives you a lot of extra functionality and control beyond the standard default options available in the dialog box.

enter image description here

6
  • Actually I think the question title is unclear (and was waiting for OP to clarify), but it seems @michaelmil has gotten the interpretation correct and we've gone the other way. I didn't really pick up on the 'ArcGIS Export Map' bit in the question, but based on that and the edit it looks like the goal is to export a finished map product to an image format with compression.
    – Chris W
    Nov 27 '14 at 21:04
  • I think that MappaGnosis has it covered, with pictures. I'd like to see the Project::save as image dialog with the part where format can be chosen highlighted but apart from that I could do no different. It's got my vote. Nov 27 '14 at 21:38
  • Ok, but the problem is how to compress raster produced starting from shape with "save as image" or with "atlas function".
    – toWGS84
    Nov 28 '14 at 9:30
  • Save it as a JPEG - that is a compressed format. You just don't have control over the level of compression but the output is definitely compressed. Nov 28 '14 at 10:12
  • yes, but if i need a tiff withs compression (like ZLW)?
    – toWGS84
    Nov 28 '14 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.