2

this may be a poor first question but it's been niggling me most of the afternoon!

I'm trying to export a series of images from QGIS 3 based on the categorisation of the data in one layer but only show one category at a time. I've done similar before in MapInfo but that meant copy/paste and then altering the query in a lot of text files in order to isolate each category before exporting it out by hand. Is there a way of doing this within QGIS in order to automate it?

Categories lined next to each other

I keep thinking I'm overlooking something basic here in order to select and single out one category at a time and export the image.

1 Answer 1

1

Un-select the categories you don't want to see in the Layers panel.

enter image description here

Export image. Repeat for next category.


Or set up an atlas in the print composer, and filter by category.

  1. Use the Minimum bounding geometry tool to generate a polygon that encloses all points in each category.

  2. Set up an atlas in the print composer using the bounding geometry as the coverage layer.

  3. Return to the map canvas. Open the style settings for the point layer, and change the style from Categorized to Rule-based. The existing categories will be converted into rules-based categories, with rules like "category" = 0. Change each rule to the equivalent of if("category"=@atlas_pagename ,"category" = 0, null). This will display only the points that match the current atlas page. Important: Delete the ELSE category.

enter image description here

Once you have all your rules set up, preview the atlas in the print composer, and flip through the pages to make sure the correct points display on each page.

  1. Export the atlas.

Note: these instructions create atlas pages that are centered and zoomed in on the atlas points in each category. If you want pages that are identical in extent, follow these steps to create an atlas layer.

1a. Create a new polygon layer and call it 'atlas_layer'. Add a polygon that covers the entire extent that you want to export in each image.

1b. Copy and paste the extent polygon until you have as many polygons as categories of point.

1c. Add an attribute field to the atlas layer, of the same type as the point categories. Call the field "category" and fill it with the same values as the point categories. Proceed from step 2, using this layer for the atlas.

1
  • Thanks! Havent used the atlas as yet and didn’t really know what it was for. Thanks so much, will try this out.
    – Fordonian
    Commented Nov 8, 2018 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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