TransWikia.com

Filtering Multiple Features in QGIS

Geographic Information Systems Asked by Catalyx on December 3, 2020

How do I select multiple features in a vector layer using the Query Builder in QGIS?

Using U.S. Census geographic data, I’m trying to select a large number of specific block groups using the GEOID feature / field.

Based on an answer found here and using the LIKE operator, I’ve used the following query in the Query Builder:

"GEOID" ILIKE ('34013000100%', '34013000200%')

This results in error:

OGR[3] error 1: SQL Expression Parsing Error: syntax error, unexpected ','.

I’ve also tried using the LIKE and IN operators; changing the wildcard from % to _ (a single underscore); and other separators replacing the comma, all with error results.

I note that filtering for a single value (such as "GEOID" ILIKE ('34013000100%') works fine.

A sample data file is found here.

One Answer

Try writing a multiple LIKE statement with the values you're trying in an IN statement.

In the image below, there are 2 sets of selected features for each LIKE statement (highlighted in pink):

"GEOID" like ('34013000100%')  
or  
"GEOID" like ('34013000200%')

enter image description here

Correct answer by DPSSpatial on December 3, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP