Feature request #1597
Default sorting of data
|Assigned to:||-||% Done:||
|Target version:||Future Release - Nice to have|
|Platform version:||Pull Request or Patch supplied:||No|
Presently, feature data are not sorted by QGIS. Also, databases do not return data in any particular order, unless explicitly sorted (e.g., "SORT BY field1 ASC, field2 DESC"). From a GIS perspective, this determines which features are drawn from first to last, which is noticeable if they are stacked (particularly polygons).
I have worked around this limitation by building VIEWs in PostgreSQL:
CREATE OR REPLACE VIEW ordered_features AS SELECT gid, geometry, collection_date FROM features ORDER BY collection_date DESC;
and adding the metadata to geometry_columns.
It would be of great convenience to be able to sort geometry features within QGIS. A potential solution for this is to add a field in Layer Properties > General, beneath Subset (aka "SQL where clause"). This could be a simple text field "SQL order clause" that gets inserted into the SQL statement when requesting data.
Updated by Mike Toews almost 8 years ago
Replying to [comment:1 gsherman]:
Why is it important what order the features are drawn?
This is important for data that happens to pile up in the same or similar place. I can think up two good examples:
Time-variable data, for example polygons of building outlines. I would like to draw the oldest buildings first followed by the newer ones. This way, the current (or at least most recent) buildings are on top. I have layers of buildings that stretch back into the 1940s, many of which have been demolished with new ones built in the same areas.
Symbol levels for points. I often have multiple points at one location that is stylized using the unique value symbology. There are certain symbols (such as "contaminated" red dot) that are more critical to see on the map than others (such as "not contaminated" green dot). (Alternatively, it might make more sense that control of symbol levels should be part of the layer properties for unique value symbology -- especially since it is difficult to sort text classifications unless they happen to be alphabetical).
Updated by Giovanni Manghi over 5 years ago
- Target version changed from Version 1.7.0 to Version 1.7.4
Updated by Giovanni Manghi almost 5 years ago
- Target version changed from Version 1.7.4 to Version 2.0.0
Updated by Pirmin Kalberer over 4 years ago
- Target version changed from Version 2.0.0 to Future Release - Nice to have
Also available in: Atom