Export a map in GRASS GIS using the m.printws addon

Author: Paulo van Breugel
Updated on: 15-08-18


GRASS GIS offers different ways to create maps for use in publications. The arguably easiest way is to create a map composition in the Map Display window and use the 'Save display to graphic file' option () to save the visible image in map display as an image. Disadvantages are that it needs some additional work to get an image without white stripes on the top/bottom or left/right. In addition, it is not possible to set the output resolution of the image.

Other ways to create an output map, like ps.map or using the d.* family of functions (used in e.g., this tutorial) offer great flexibility, but they require more effort. The m.printws addon provides a middle-ground solution by adding a quick 'print workspace file' function to GRASS GIS. So what does that mean?

A workspace file is a file that saves the layer tree composition, including the layers display option, of your current session. When you start a new GRASS GIS session, you can open a workspace file and all layers and their display options defined in that file are restored. I.e., it resembles a QGIS project file. The m.printws addon uses the information from the workspace file to renders a map that looks the same as the one you created before in your Map display. An important difference with the 'Save display to graphic file' option is that you can set the resolution of the output image. There are furthermore a number of additonal options to further fine-tune the final map to your likening. Check the manual page for further details.

So, when would you use this addon? User cases are to:

  • Get a high resolution bitmap or PDF copy of a workspace composition;
  • Produce a quick printable page of the current screen composition;
  • Use the main GRASS GIS window as a mapset composer.
  • Automatic redraw and regeneration of illustrations attached to a publication.

If you have questions

If you have questions or comments about the text, let me know. You can use this contact form. Please make sure to include the page title ("Export a map in GRASS GIS using the m.printws addon") or page name ("mprintws addon").