22.3. Creating an Output — QGIS Documentation documentation (2024)

Fig. 22.62 shows an example print layoutincluding all the types of layout items described in the previoussection.

From the Layout menu or toolbar, you can output the printlayout to different file formats, and it is possible to modify the resolution(print quality) and paper size:

  • The Print icon allows you to print the layout to aconnected printer or a PostScript file, depending on the installed printerdrivers.

  • The Export as image icon exports the print layoutimage formats such as PNG, BMP, TIF, JPG,and many others…

  • The Export as SVG icon saves the print layoutas an SVG (Scalable Vector Graphic).

  • The Export as PDF icon saves the defined print layoutdirectly as a PDF (Portable Document Format) file.

22.3.1. Export settings

Whenever you export a print layout, there are a selection of export settings QGIS needsto check in order to produce the most appropriate output. These configurationsare:

  • The Export settings of the Layoutpanel, such as Export resolution, Print as rasterAlways export as vectors or Save world file

  • Exclude page from exports in the page item properties panel

  • Exclude item from exports in the item properties panel

Moreover, a number of predefined checks are automatically applied to the layout.Currently these checks include testing that scalebars are correctly linked to map items,and that map overview items are also correctly linked to a map.If the checks fail, you are shown a nice warning advising you of the issue.

22.3.2. Export as Image

To export a layout as an image:

  1. Click the Export as image icon

  2. Select the image format, the folder and filename (e.g. myill.png)to use.If the layout contains more than one page, each page will be exported toa file with the given filename with the page number appended(e.g. myill_2.png).

  3. In the next (Image Export Options) dialog:

    • You can override the print layout Export resolution and theexported page dimensions (as set in Layout panel).

    • Image rendering can also be improved with the Enableantialiasing option.

    • If you want to export your layout as a georeferenced image (e.g., toshare with other projects), check the Generateworld file option, and an ESRI World File with the same name as theexported image, but a different extension (.tfw for TIFF,.pnw for PNG, jgw for JPEG, …) will be created whenexporting.This option can also be checked by default in the layout panel.

      Note

      For multi-page output, only the page that contains thereference map will get a world file (assuming that theGenerate world file option is checked).

    • By checking Crop to content option, the image outputby the layout will include the minimal area enclosing all the items (map,legend, scale bar, shapes, label, image…) of each page of the composition:

      • If the composition includes a single page, then the output is resized toinclude EVERYTHING on the composition. The page can then be reduced orextended to all items depending on their position (on, above, below, left orright of the page).

      • In case of a multi-page layout, each page will be resized to include items inits area (left and right sides for all pages, plus top for the first page andbottom for the last page). Each resized page is exported to a separate file.

      The Crop to content dialog also lets you add margins aroundthe cropped bounds.

    • By checking Open file after exporting the exportedfile will automatically open in the default image viewer.

22.3. Creating an Output — QGIS Documentation documentation (10)

Tip

Use image formats that support transparency when items extendbeyond the paper extent

Layout items may be placed outside the paper extent. When exportingwith the Crop to content option, the resultingimage may therefore extend beyond the paper extent.Since the background outside of the paper extent will be transparent,for image formats that do not support transparency(e.g. BMP and JPG) the transparent background will berendered as full black, “corrupting” the image.Use transparency-compatible formats (e.g. TIFF and PNG)in such cases.

Note

When supported by the format (e.g. PNG) and theunderlying Qt library, the exported image may include projectmetadata (author, title, date, description…)

22.3.3. Export as SVG

To export a layout as SVG:

  1. Click the Export as SVG icon

  2. Fill in the path and filename (used as a base name for all thefiles in case of multi-page composition, as for image export)

  3. In the next SVG Export Options dialog, you can override thelayout default export settings or configurenew ones:

    • Export map layers as SVG groups: exported items aregrouped within layers whose name matches the layer names from QGIS, makingit much easier to understand the contents of the document.

    • Always export as vectors: some rendering optionsrequire items to be rasterized for a better rendering. Check this option tokeep the objects as vectors with the risk that the appearance of the outputfile may not match the print layout preview (for more details, seeExport settings).

    • Export RDF metadata of the document such as thetitle, author, date, description…

    • Simplify geometries to reduce output file size: thisavoids exporting ALL geometry vertices, which can result in a ridiculouslycomplex and large export file size that could fail to load in other applications.Geometries will be simplified while exporting the layout in order to removeany redundant vertices which are not discernably different at the exportresolution (e.g. if the export resolution is 300 dpi, vertices that areless than 1/600 inch apart will be removed).

    • Set the Text export: controls whether text labels are exportedas proper text objects (Always export texts as textobjects) or as paths only (Always export texts as paths).If they are exported as text objects, they can be edited in externalapplications (e.g. Inkscape) as normal text. BUT the side effect is thatthe rendering quality is reduced, AND there are issues with rendering whencertain text settings like buffers are in place. That’s why exporting aspaths is recommended.

    • Apply Crop to content option

    • Disable tiled raster layer exports: When exportingfiles, QGIS uses a built-in raster layer tiled rendering that saves memory.Sometimes, this can cause visible “seams” in the rastersfor generated files. Checking this option would fix that, at the cost of ahigher memory usage during exports.

    • By checking Open file after exporting the exportedfile will automatically open in the default SVG viewer.

22.3. Creating an Output — QGIS Documentation documentation (19)

Note

Currently, the SVG output is very basic. This is not a QGIS problem, but aproblem with the underlying Qt library. This will hopefully be sorted outin future versions.

22.3.4. Export as PDF

To export a layout as PDF:

  1. Click the Export as PDF icon

  2. Fill in the path and filename: unlike for image and SVG export, all thepages in the layout are exported to a single PDF file.

  3. In the next PDF Export Options dialog, you can override thelayout default export settings or configurenew ones:

    • Always export as vectors: some rendering optionsrequire items to be rasterized for a better rendering. Check this option tokeep the objects as vectors with the risk that the appearance of the outputfile may not match the print layout preview (for more details, seeExport settings).

    • Append georeference information: available only ifthe reference map, from which the information is taken,is on the first page.

    • Export RDF metadata of the document such as thetitle, author, date, description…

    • Set the Text export: controls whether text labels are exportedas proper text objects (Always export texts as textobjects) or as paths only (Always export texts as paths).If they are exported as text objects then they can be edited in externalapplications (e.g. Inkscape) as normal text. BUT the side effect is thatthe rendering quality is decreased, AND there are issues with rendering whencertain text settings like buffers are in place. That’s why exporting aspaths is recommended.

    • Control the PDF Image compression using:

      • Lossy (JPEG), which is the default compression mode

      • or Lossless, which creates bigger files in most cases, but ismuch more suitable for printing outputs or for post-production in externalapplications (requires Qt 5.13 or later).

    • Create Geospatial PDF (GeoPDF):Generate a georeferenced PDF file.

    • Disable tiled raster layer exports: When exportingfiles, QGIS uses tiled based rendering that saves memory.Sometimes, this can cause visible “seams” in the rasters for generated files.Checking this option would fix that, at the cost of a higher memory usageduring exports.

    • Simplify geometries to reduce output file size:Geometries will be simplified while exporting the layout by removingvertices that are not discernably different at the export resolution(e.g. if the export resolution is 300 dpi, vertices that are lessthan 1/600 inch apart will be removed).This can reduce the size and complexity of the export file (very largefiles can fail to load in other applications).

    • By checking Open file after exporting the exportedfile will automatically open in the default PDF viewer.

22.3. Creating an Output — QGIS Documentation documentation (28)

Note

GeoPDF export is supported, and a number of GeoPDF specific optionsare available:

  • Format (GeoPDF format - there are some GeoPDF variations),

  • Include multiple map themes (specify map themes to include),

  • Include vector feature information (choose the layers andgroup them into logical PDF groups).

Note

Exporting a print layout to formats that supports georeferencing(e.g. PDF and TIFF) creates a georeferenced output by default.

22.3.5. Generate an Atlas

Atlas functions allow you to create map books in an automated way.Atlas uses the features of a table or vector layer(Coverage layer) to create an output for each feature(atlas feature) in the table / layer.The most common usage is to zoom a map item to the current atlasfeature.Further use cases include:

  • a map item showing, for another layer, only features that share the sameattribute as the atlas feature or are within its geometry.

  • a label or HTML item whose text is replaced as features are iterated over

  • a table item showing attributes of associated parent or children features of the current atlas feature…

For each feature, the output is processed for all pages and items accordingto their exports settings.

Tip

Use variables for more flexibility

QGIS provides a large panel of functions andvariables, including atlas related ones,that you can use to manipulate the layout items, but also the symbology ofthe layers, according to atlas status.Combining these features gives you a lot of flexibility and helps youeasily produce advanced maps.

To enable the generation of an atlas and access atlas parameters, refer tothe Atlas panel. This panel contains the following(see Fig. 22.66):

22.3. Creating an Output — QGIS Documentation documentation (29)
  • Generate an atlas enables or disables atlasgeneration.

  • Configuration

    • A Coverage layer combo box that allows you tochoose the table or vector layer containing the features to iterate over.

    • An optional Hidden coverage layer that, if checked,will hide the coverage layer (but not the other layers) during the generation.

    • An optional Page name combo box to specify the name for thefeature page(s).You can select a field of the coverage layer or set anexpression.If this option is empty, QGIS will use an internal ID, according to thefilter and/or the sort order applied to the layer.

    • An optional Filter with text area that allows youto specify anexpression for filtering features from the coverage layer. If the expressionis not empty, only features that evaluate to True will be processed.

    • An optional Sort by that allows you tosort features of the coverage layer (and the output), using a field of thecoverage layer or an expression.The sort order (either ascending or descending) is set by the two-stateSort direction button that displays an up or a down arrow.

  • Output - this is where the output of the atlas can be configured:

    • An Output filename expression textbox that is used to generatea filename for each atlas feature. It is based on expressions.is meaningful only for rendering to multiple files.

    • A Single file export when possible that allows you toforce the generation of a single file if this is possible with the chosen outputformat (PDF, for instance). If this field is checked, the value of theOutput filename expression field is meaningless.

    • An Image export format drop-down list to select the output formatwhen using the Export atlas as Images… button.

22.3.5.1. Control map by atlas

The most common usage of atlas is with the map item, zooming to the current atlasfeature, as iteration goes over the coverage layer. This behavior is set inthe Controlled by atlas group properties of the map item. SeeControlled by atlas for different settings you can apply on the map item.

22.3.5.2. Customize labels with expression

In order to adapt labels to the feature the atlas iterates over, you caninclude expressions. Make sure that you place the expression part(including functions, fields or variables) between [% and %] (seeThe Label Item for more details).

For example, for a city layer with fields CITY_NAME and ZIPCODE,you could insert this:

The area of [% concat( upper(CITY_NAME), ',', ZIPCODE, ' is ',format_number($area/1000000, 2) ) %] km2

or, another combination:

The area of [% upper(CITY_NAME)%],[%ZIPCODE%] is[%format_number($area/1000000,2) %] km2

The information[% concat( upper(CITY_NAME), ',', ZIPCODE, ' is ', format_number($area/1000000, 2) ) %]is an expression used inside the label.Both expressions would result in the following type of label in thegenerated atlas:

The area of PARIS,75001 is 1.94 km2

22.3.5.3. Explore Data-defined override buttons with atlas

There are several places where you can use a Data defined override button to override the selected setting.This is particularly useful with atlas generation.See Data defined override setup for more details on this widget.

For the following examples the Regions layer of the QGIS sampledataset is used and selected as Coverage layer forthe atlas generation.We assume that it is a single page layout containing a map item anda label item.

When the height (north-south) of a region extent is greater than itswidth (east-west), you should use Portrait instead of Landscapeorientation to optimize the use of paper.With a Data Defined Override button you candynamically set the paper orientation.

Right-click on the page and select Page Properties to open thepanel. We want to set the orientation dynamically, using an expressiondepending on the region geometry, so press the button offield Orientation, select Edit… to open theExpression string builder dialog and enter the followingexpression:

CASE WHEN bounds_width(@atlas_geometry) > bounds_height(@atlas_geometry)THEN 'Landscape' ELSE 'Portrait' END

Now if you preview the atlas, the paper orients itselfautomatically, but item placements may not be ideal. For each Region you need toreposition the location of the layout items as well. For the map item you canuse the button of its Width property to set itdynamic using the following expression:

@layout_pagewidth - 20

Likewise, use the button of the Height property toprovide the following expression to constrain map item size:

@layout_pageheight - 20

To ensure the map item is centered in the page, set its Referencepoint to the upper left radio button and enter 10 for its Xand Y positions.

Let’s add a title above the map in the center of the page. Select the labelitem and set the horizontal alignment to Center.Next move the label to the right position, choose the middle button forthe Reference point, and provide the following expression forfield X:

@layout_pagewidth / 2

For all other layout items you can set the position in a similar way so theyare correctly positioned both for portrait and landscape.You can also do more tweaks such as customizing the title withfeature attributes (see Customize labels with expression example), changing images,resizing the number of legend columns number according to page orientation,…

The information provided here is an update of the excellent blog (in Englishand Portuguese) on the Data Defined Override optionsMultiple_format_map_series_using_QGIS_2.6 .

Another example for using data-defined override buttons is the usage of a dynamicpicture. For the following examples we use a geopackage layer containing a BLOB fieldcalled logo with the field type binary (see Creating a new GeoPackage layer).For every feature there is defined a different picture so that the atlas can iterateover as described in Preview and generate an atlas.All you need to do is add a picture in the print layout and go to itsItem properties in the atlas context. There you can find adata-defined override button in the Image source section of theMain Properties.

22.3. Creating an Output — QGIS Documentation documentation (43)

In the following window choose Edit so that the Expression String Builderopens. From the Fields and values section you can find the BLOB field thatwas defined in the geopackage layer. Double-click the field name logo and click OK.

22.3. Creating an Output — QGIS Documentation documentation (44)

The atlas iterates over the entries in the BLOB field provided that you choose the geopackagelayer as Coverage layer (further instructions you can find in Preview and generate an atlas).

These are just two examples of how you can use some advanced settings with atlas.

22.3.5.4. Preview and generate an atlas

22.3. Creating an Output — QGIS Documentation documentation (45)

Once the atlas settings have been configured, and layout items (map, table,image…) linked to it, you can create a preview of all the pages by choosingAtlas ► Preview Atlas or clicking the Preview Atlas icon.You can then use the arrows to navigate through all the features:

  • First feature

  • Previous feature

  • Next feature

  • Last feature

You can also use the combo box to select and preview a specific feature.The combo box shows atlas feature names according to the expression set in theatlas Page name option.

As for simple compositions, an atlas can be generated in different ways (seeCreating an Output for more information -just use tools from the Atlas menu or toolbar instead of theLayout menu.

This means that you can directly print your compositions withAtlas ► Print Atlas.You can also create a PDF using Atlas ► Export Atlas as PDF…:You will be asked for a directory to save all the generated PDF files,except if the Single file export when possible has beenselected. In that case, you’ll be prompted to give a filename.

With Atlas ► Export Atlas as Images… orAtlas ► Export Atlas as SVG… tool, you’re also prompted toselect a folder. Each page of each atlas feature composition is exported tothe image file format set in Atlas panel or to SVG.

Note

With multi-page output, an atlas behaves like a layout in that only thepage that contains the General settings will get a world file (foreach feature output).

Tip

Print a specific atlas feature

If you want to print or export the composition of only one feature of the atlas,simply start the preview, select the desired feature in the drop-down listand click on Layout ► Print (or Export…to any supported file format).

22.3.5.5. Use project defined relations for atlas creation

For users with HTML and Javascript knowledge it is possible to operate onGeoJSON objects and use project defined relations from the QGIS project.The difference between this approach and using expressionsdirectly inserted into the HTML is that it gives you a full,unstructured GeoJSON feature to work with. This means that you can useexisting Javascript libraries and functions that operate on GeoJSONfeature representations.

The following code includes all related child features from the defined relation.Using the JavaScript setFeature function it allows you to make flexible HTMLwhich represents relations in whatever format you like (lists, tables, etc).In the code sample, we create a dynamic bullet list of the related child features.

// Declare the two HTML div elements we will use for the parent feature id// and information about the children<div id="parent"></div><div id="my_children"></div><script type="text/javascript"> function setFeature(feature) { // Show the parent feature's identifier (using its "ID" field) document.getElementById('parent').innerHTML = feature.properties.ID; //clear the existing relation contents document.getElementById('my_children').innerHTML = ''; feature.properties.my_relation.forEach(function(child_feature) { // for each related child feature, create a list element // with the feature's name (using its "NAME" field) var node = document.createElement("li"); node.appendChild(document.createTextNode(child_feature.NAME)); document.getElementById('my_children').appendChild(node); }); }</script>

During atlas creation there will be an iteration over the coverage layercontaining the parent features. On each page, you will see a bullet list ofthe related child features following the parent’s identifier.

22.3. Creating an Output — QGIS Documentation  documentation (2024)

References

Top Articles
◉ Agropecuario Argentino vs. Racing (Cba) en vivo: seguí el partido minuto a minuto - TyC Sports
Pharmacy Technician, Tisch Hospital - overnight job at NYU Langone Health – 1130629_RR00093678
Phcs Medishare Provider Portal
Bin Stores in Wisconsin
The Daily News Leader from Staunton, Virginia
80 For Brady Showtimes Near Marcus Point Cinema
Arrests reported by Yuba County Sheriff
Delectable Birthday Dyes
Gw2 Legendary Amulet
Horned Stone Skull Cozy Grove
Does Publix Have Sephora Gift Cards
PGA of America leaving Palm Beach Gardens for Frisco, Texas
Obituary Times Herald Record
Uvalde Topic
Simple Steamed Purple Sweet Potatoes
Craigslist Dog Kennels For Sale
Brutál jó vegán torta! – Kókusz-málna-csoki trió
Gon Deer Forum
iLuv Aud Click: Tragbarer Wi-Fi-Lautsprecher für Amazons Alexa - Portable Echo Alternative
Grandview Outlet Westwood Ky
Hanger Clinic/Billpay
TBM 910 | Turboprop Aircraft - DAHER TBM 960, TBM 910
Van Buren County Arrests.org
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Riherds Ky Scoreboard
Cincinnati Adult Search
Pirates Of The Caribbean 1 123Movies
About My Father Showtimes Near Copper Creek 9
Netwerk van %naam%, analyse van %nb_relaties% relaties
Impact-Messung für bessere Ergebnisse « impact investing magazin
Speedstepper
FAQ's - KidCheck
How do you get noble pursuit?
Craigslist Brandon Vt
Grave Digger Wynncraft
100 Gorgeous Princess Names: With Inspiring Meanings
Core Relief Texas
Southtown 101 Menu
Sinai Sdn 2023
Rvtrader Com Florida
Mg Char Grill
Reli Stocktwits
PA lawmakers push to restore Medicaid dental benefits for adults
Pinellas Fire Active Calls
Frcp 47
How are you feeling? Vocabulary & expressions to answer this common question!
Unlock The Secrets Of "Skip The Game" Greensboro North Carolina
Scythe Banned Combos
Gt500 Forums
Rite Aid | Employee Benefits | Login / Register | Benefits Account Manager
Frank 26 Forum
Zalog Forum
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6776

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.