2

I try to make a set of maps using QGIS Atlas. My maps will consist of selected feature with it's attributes (using $id = @atlas_featureid, and that's working). Basically - districts in particular city with population, from the lowest to highest. But I want also to show the previous shown features grayed out/in different color/etc. Like here GeoGIF.

I've found that the solution could be a formula $id <= @atlas_featureid. But it's not working properly in my case. The problem I've found is that ID of features in my project does not correspond to the order of features I want to show.

enter image description here

In my project - the order of maps generated with atlas is based on population value, from lowest to highest. How to handle this problem?

2 Answers 2

1

I don't think $id has anything to do with the sort order of your districts. if you are sure of your features sort order first build a query in which you add an 'order' attribute (being the 'ranking' of your elements) that you will then use in the styling of your layer.

5
  • Well, I've done it first. And I think that $id really does a difference here. On the picture above -the marked polygon has $id = 4. All the greyed out features has $id = 0, 1, 2, 3... I've checked it. I this case, since this feature is the first one (with order value = 1) it shall be the only feature selected...
    – muszynov
    Commented Jan 20, 2018 at 9:59
  • 1
    weird ... i made several tests with different sort orders in the atlas generation. $id are 'static' (i mean : linked to a given feature) and never changed despite the change in the sort oder of the atlas ...
    – Snaileater
    Commented Jan 20, 2018 at 10:15
  • Does the type of column on which the sorting is based makes a difference? I try to do many combinations but still, no progress!
    – muszynov
    Commented Jan 20, 2018 at 10:21
  • weird you came to a case where $id were 0,1, 2, 3 ...
    – Snaileater
    Commented Jan 20, 2018 at 10:34
  • But in QGIS feature $id starts with 0. $rownum starts with 1.
    – muszynov
    Commented Jan 20, 2018 at 10:35
1

I've found the answer. And the $id really makes a difference here. If You want to change the order of features basing on id, there is a MMQGIS plugin. Use "Modify" and "Sort" option to change the $id based on column chosen. Now it's working properly.

2
  • would be nice to find a solution without that extra step of modifying and saving a copy of the original layer ...
    – Snaileater
    Commented Jan 20, 2018 at 14:30
  • Well, it's problematic since the $id attribute is crucial for shapefile consistency. This solution doesn't take much time and often You only need 1-2 copies of original layer.
    – muszynov
    Commented Jan 20, 2018 at 18:53

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.