Skip to main content
35 votes
Accepted

What is the difference between != NULL and IS NOT NULL in QGIS filter expressions?

Disclaimer: Because the syntax for filtering in QGIS works with SQL, I'm assuming here that SQL rules apply. I'm not completely sure if that's entirely correct, but it seems logical and it does ...
karpfen's user avatar
  • 2,307
26 votes

Using IN-operator in query builder in QGIS

You could use something like: "Territory" IN ('India', 'China', 'Bhutan')
Joseph's user avatar
  • 76k
24 votes

What is the difference between != NULL and IS NOT NULL in QGIS filter expressions?

NULL is not a value, therefore it cannot equal = or not equal != anything. It is not the same as zero 0 which is a value. A NULL indicates that no value has been recorded in the cell you are looking ...
Midavalo's user avatar
  • 29.8k
17 votes
Accepted

Filtering layers in QGIS atlas

You can use the tbl_metadata file as coverage layer in Atlas. Then use rule-based symbology with @layer_name = @atlas_pagename. I assume that your data looks like this (the attribute table is ...
Oto Kaláb's user avatar
  • 6,925
15 votes
Accepted

QGIS query syntax differs between attribute table and feature filter

Your observation is correct, The Query Builder does not use the same syntax as the rest of QGIS. Throughout QGIS, the syntax is based on QGIS Expressions a customized SQL dialect. This is portable ...
Matthias Kuhn's user avatar
14 votes
Accepted

Filtering with setSubsetString using PyQGIS

Change layer.setSubsetString("GAMME_DE_S=VSR") to layer.setSubsetString("GAMME_DE_S='VSR'") Then to add the layer if not layer.isValid(): print("Layer failed to load!&...
ThomasG77's user avatar
  • 31k
13 votes
Accepted

Filter a GeoPandas dataframe for points within a specific country

Did you see More Efficient Spatial join in Python without QGIS, ArcGIS, PostGIS, etc and other answers on GIS SE ? Simply import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('...
gene's user avatar
  • 55.1k
13 votes
Accepted

Filtering layers by geometry type using PyQGIS

You can simply use the isSpatial() method of the QgsVectorLayer class, to filter geometry and geometryless layers. Additionally, you should not use numbers to do such comparisons. Recommendations ...
Germán Carrillo's user avatar
12 votes

how to visualize csv data every 10 rows in QGIS

Assuming you don't have a unique id field, you can use rule based symbols with the following filter $id % 10 = 1 The % sign is equivalent to remainder, so any row that divides by 10 with a ...
HDunn's user avatar
  • 8,666
12 votes
Accepted

Filtering by geometry type in GeoPandas

There are many solutions (see How to filter a geodataframe by geometry type? for example) With .loc as you but with geometry.type or geom_type gdf0 = gdf.loc[gdf.geometry.geometry.type=='MultiPolygon']...
gene's user avatar
  • 55.1k
12 votes

Filtering which points to display using expressions in QGIS

Use either "Drilled ID" in ('value1','value4','value8') Or "Drilled ID" = 'value1' or "Drilled ID" = 'value4' or "Drilled ID" = 'value8'
MrXsquared's user avatar
  • 34.9k
11 votes

QGIS using project variables in filter queries

Layer filters don't use QGIS expressions, and are instead handed directly off to the underlying data provider. So, for instance, a filter on a postgis layer is passed to postgres to evaluate, and ...
ndawson's user avatar
  • 27.7k
11 votes

How to filter image collection by date, excluding a date from a date range in Google Earth Engine

You can remove images from an image collection by creating a date filter for the 'bad/missing' data and then remove it using ee.Filter.not(). For example: var collection = ee.ImageCollection('NCEP_RE/...
Tyler Erickson's user avatar
11 votes
Accepted

Multiple date filter Google Earth Engine

Your Code These lines don't seem to work out: var dateFilter = ee.ImageCollection(longRain2016.merge(shortRain2016).merge(longRain2017).merge(shortRain2017).merge(longRain2018)); var s2dateFilter = ...
StefanBrand_EOX's user avatar
11 votes

Filtering by geometry type in GeoPandas

Using geometry.type=="MULTIPOLYGON" is (15 times in my computer) faster. at_geometries[at_geometries.geometry.type=="MULTIPOLYGON"]`
Kadir Şahbaz's user avatar
11 votes
Accepted

Filtering which points to display using expressions in QGIS

Switch to Rule-based and use "Drilled ID" IN ('value1', 'value4','value8') Consider setting a filter if you don't want to display anything else.
Bera's user avatar
  • 74.8k
10 votes
Accepted

Google earth engine: filter a FeatureCollection by system id

This is tricky, as there are actually two issues: It's called system:index even though the UI shows it as id. The id is a string, rather than an integer So the correct way to do this is: print(FC....
Matifou's user avatar
  • 2,021
10 votes

Filtering with setSubsetString using PyQGIS

Pay attention to quotes: Subset string is an expression. You have to use single quotes for string values. A text placed between single quotes ('VSR') is interpreted as a string. Double quotes will ...
Kadir Şahbaz's user avatar
9 votes
Accepted

Filter GeoJSON by attribute in Leaflet using a button

You need to create a grouplayer and from that you can add or remove the layer, in that way refreshing the data with the filter from the same dataset. Here are two working examples: the first using ...
Bill Chappell's user avatar
8 votes
Accepted

Custom marker based on geojson attribute in Leaflet

First, your GeoJSON is invalid. Each feature should have a geometry and a properties property. i.e. the following is wrong: var feature = { "type":"Feature", "geometry":{ "type":"Point", "...
IvanSanchez's user avatar
  • 10.3k
8 votes
Accepted

Filtering earth engine image collection by image ID

Alright, I figured it out. Filtering can be done using the image properties (you can see what properties are available by searching for the product in the search bar). In this case, NASA's NEX-DCP30 ...
JepsonNomad's user avatar
  • 2,166
8 votes
Accepted

subset FeatureCollection by position - Google Earth Engine

For the first and last elements of a collection, there are shortcuts collection.first() and collection.last(). For the nth element of a collection, cast the collection to a list, then get the nth ...
Christoph Rieke's user avatar
8 votes
Accepted

Filtering rows by letter QGIS

In QGIS text strings are enclosed in single quotes (') while double quotes (") are for field names, so your expression should be: "areakm2" > 80000 AND left("NAME", 1)='A'
J.R's user avatar
  • 16.6k
8 votes
Accepted

Displaying only visible in canvas features in attribute table using PyQGIS

I dont know what can be done in plugins and not, but in QGIS you can apply a filter: layer = iface.activeLayer() mapcanvas = iface.mapCanvas() rect = mapcanvas.extent() request = QgsFeatureRequest()....
Bera's user avatar
  • 74.8k
8 votes
Accepted

Excluding zero values in proportion calculation in QGIS

Use this expression: array_mean( array_remove_all( array("field1", "field2", ...), 0 -- set here the value to be excluded ) )
Mayo's user avatar
  • 3,977
8 votes
Accepted

Filtering data containing numeric values in QGIS

Use the following expression with function regexp_match(). The Regular Expression \\d finds any digit. Use double backslashes, because in QGIS, Backslash characters must be double escaped ...
Babel's user avatar
  • 73.1k
8 votes

Replace single and double quotes with QGIS expressions

you can use this expression: replace(replace("fieldname", char(34), ''), char(39), '') char(34) corresponds to the double quote " char(39) corresponds to the simple quote '
Kalak's user avatar
  • 3,880
7 votes
Accepted

Aggregating with attribute($currentfeature) filter in QGIS

It turns out that the filter you are passing to the aggregate function always returns True for any feature. "Field2" = attribute( $currentfeature, 'Field2') In other words, what you have at the ...
Germán Carrillo's user avatar
7 votes
Accepted

Filter image collection with a date list in Google Earth Engine?

Make a list of millisecond dates, and then use filter inList: var collection = ee.ImageCollection("MODIS/MYD11A1").select('LST_Day_1km'); var reference = collection.filterDate('2016-01-01', '2016-12-...
Rodrigo E. Principe's user avatar
7 votes

Filter a GeoPandas dataframe for points within a specific country

uk = world.ix[world['name']=='United Kingdom'] uk_mask = momdata.within(uk.loc[0, 'geometry']) uk_momdata = momdata.loc[uk_mask] uk_momdata Taken from the following tutorial: https://automating-gis-...
LucieCBurgess's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible