3

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.

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Aug 11, 2021 at 0:17
3
  • 3
    Are you using PyQGIS to try and do the iteration? Commented Aug 11, 2021 at 0:36
  • 2
    Can you show us exactly what you've tried so far? Commented Aug 11, 2021 at 5:52
  • 2
    Is 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. Commented Aug 11, 2021 at 6:01

1 Answer 1

2

Let's assume there is a point layer 'random_point_test' with its attribute table, see image below.

input

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_1

Step 2. Apply the "Split vector layer" to split features based on the "class" attribute as 'Unique ID field' and get the final output

output

So, in the end there will be three groups of points, based on "class" attribute.

answered Aug 11, 2021 at 6:19

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.