1

I have a point shapefile in QGIS (3.30.2) containing more than 2000 points. I selected about 150 of these points based on a special criteria.
I need to create a separate shapefile with only these 200 points. I usually select the desired rows in attribute table manually and use 'Export > Save selected features as >'. Considering the high number of points (150), is there an easier way to select these rows?

Update: I don't think it is possible to use 'select by expression', because they do not have a value greater or less than a specific amount. They are not categorized in any way.

Each point has a number associated to it and I selected them based on their photo, which had a particular characteristic, and the photo was inside a link, in one of the fields of the attribute table.

So, the only way, in my opinion, is to write the number of all these 150 point in an expression and use 'OR' or 'AND' to select them all. Is that correct? Which expression would use less time?

6
  • 1
    You mean like using "select by expression" to select all points with population "greater than 1000" or something? That's what "select by expression" (button in attribute table toolbar) does.
    – Spacedman
    Nov 13, 2023 at 14:38
  • I updated the question.
    – Paris
    Nov 13, 2023 at 14:54
  • 2
    if you can't generalize your selection decision and must look for these 150 photos one by one to decide ... you are doing it the best way to my knwoledge. But you may be inspired to look your decision making and optimize it a bit Nov 13, 2023 at 15:15
  • 4
    Writing an expression with 150 clauses is going to be a huge amount of work and will take much longer than just manually selecting them. However, once they are selected, use Field Calculator to calculate a new field to signify that they are selected (for example, either an integer 1 or 0, a boolean field, or a text string 'selected'). That way you have a permanent record of which you selected and this field can then be used in a filter later.
    – Matt
    Nov 13, 2023 at 15:34
  • 1
    If you can put those 150 numbers in a non-spatial table then you can (possibly) do a "join" based on an expression on the source table that gets the number from the attribute and then selects based on the success/fail status of the join. Is there any chance you could expand on this a bit more with maybe a screenshot of the attribute table of your source layer and show what part of the attribute decides if a point is included or now?
    – Spacedman
    Nov 13, 2023 at 15:44

2 Answers 2

1

Best way to use Select by expression to select, based on an arbitrary array of numbers from the attribute field foto, is to use this expression:

"foto" in (84,46,78,97,18)

enter image description here

You can't permanently save a seletion (unlike in graphic software) but as mentioned by @Matt, you can create a new field selected with the expression is_selected() that returns true for all selected features.

1
  • 1
    Thanks. I guess this would be the best way.
    – Paris
    Nov 14, 2023 at 7:48
0

If you hace already selected your desired objects, you can use the Extract by expression tool. Simply check the Selected objects checkbox and put a 1 in the Expression box. enter image description here

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.