I am working on the school project in QGIS, in which I have Price map of the buildings in a vector layer. Each polygon has its price attribute. The maximal value of price is 20 000.
I would like to decompose the layer and create new selection (and layers as well) where would I have only buildings in specific range of prices. It would start [0;1000), [1000;2000) up to 20 000.
I was trying to loop in the "Select by Expression", however I was not successful so far.
-
3Are you using PyQGIS to try and do the iteration?PolyGeo– PolyGeo ♦2021年08月11日 00:36:25 +00:00Commented Aug 11, 2021 at 0:36
-
2Can you show us exactly what you've tried so far?malin-fischer– malin-fischer2021年08月11日 05:52:30 +00:00Commented Aug 11, 2021 at 5:52
-
2Is the aim of the school project to learn about coding and expressions? Or to produce the content output as a map? its possible you are using a sledgehammer to solve a problem which a simple style category could solve. If you could update your question a bit more, that would help heaps.nr_aus– nr_aus2021年08月11日 06:01:00 +00:00Commented Aug 11, 2021 at 6:01
1 Answer 1
Let's assume there is a point layer 'random_point_test'
with its attribute table, see image below.
Step 1. Create a "class"
attribute that will brake "value"
s into ranges
In the "Field Calculator" the following expression was used:
CASE
WHEN "value" > 0 AND "value" <= 33 THEN 1
WHEN "value" > 33 AND "value" <= 66 THEN 2
ELSE 3
END
Step 2. Apply the "Split vector layer" to split features based on the "class"
attribute as 'Unique ID field' and get the final output
So, in the end there will be three groups of points, based on "class"
attribute.
Explore related questions
See similar questions with these tags.