I have just tried this whilst working with some Openstreetmap data
downloaded using the OSM Downloader plugin, and loaded into QGIS
(3.16.9) directly from the .osm XML file.
The 'osm lines' layer has a highway attribute with 16 unique values and
NULLs. Using Select by Expression with the following:
"highway" NOT IN ( 'bridleway' , 'cycleway' , 'footway' )
correctly selected rows with different values to these, but not the NULL
rows. To include NULLS, try this:
coalesce( "highway",'') NOT IN ( 'bridleway' , 'cycleway' , 'footway' )
Creating a virtual layer using the following SQL:
SELECT * FROM "osm lines" WHERE highway NOT IN ( 'bridleway' , 'cycleway' ,
'footway' )
Returned the same set of rows as the first expression, again without the
NULLs.
These results are what I would expect, I am not sure why yours differ.
Cheers,
Andy
On 07/07/2021 08:23, Andrew Hughes wrote:
*CAUTION:* This e-mail originated outside the University of Southampton.
Hi All,
I can't for the life of me figure out why I can't "Select all features
that are *_NOT_* an alley, drive-through, driveway.... "
I am trying to use "Select by Expression".
The attribute I am trying to filter with is called "tag_service" and
has 77 distinct values, including NULL.
*Q: Why does this expression select nothing?*
/"tag_service" NOT IN ('alley', 'drive-through', 'driveway',
'laneway', 'parking_aisle', 'parking')/
Supplementary, the following does select records (but I want the above
expression to work):
/"tag_service" IS NULL or "tag_service" = "service"/
Help would be much appreciated,
Thank you
Andrew
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
--
Andy Harfoot
Skype: gdi_ajph
Teams: a...@soton.ac.uk
GeoData Institute
University of Southampton
Southampton
SO17 1BJ
www.geodata.soton.ac.uk
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user