Hot answers tagged

56 votes
Accepted

Filtering features in other layers of QGIS Atlas

Indeed, you need to use rule-based symbology to achieve what you want. You need to create a rule for what you want to show, and ELSE rule for all others. In the ELSE rule, deselect the symbol ...
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 ...
  • 2,283
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 ...
  • 29.4k
24 votes

Using IN-operator in query builder in QGIS

You could use something like: "Territory" IN ('India', 'China', 'Bhutan')
  • 74.2k
16 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 ...
  • 6,667
15 votes
Accepted

How to apply a filter to multiple vector layers in QGIS?

This is how I'd do it with PyQGIS: In your QGIS ToC, turn off those layers that you want to keep untouched, i.e., leave visible only the layers you want to set the filter to. Now open a QGIS Python ...
14 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 ...
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 ...
  • 8,456
12 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 ...
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'
  • 30.4k
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 ...
  • 27k
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.
  • 61.1k
10 votes

QGIS filter on date value

I was able to filter using "START_DATE" > '2001-01-01' (double quote for Fields and single quote for Variable are important) if I opened the attribute table and used select by expression, but the ...
  • 1,677
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....
  • 1,931
10 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('...
  • 53.4k
10 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 = ...
10 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"]`
10 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']...
  • 53.4k
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 ...
8 votes
Accepted

WFS Intersect Filter using a Polygon returns all features in Layer

Try with intersects: <ogc:Intersects> ... </ogc:Intersects>
  • 2,183
8 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/...
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 ...
  • 1,876
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'
  • 13.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()....
  • 61.1k
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 ) )
  • 2,509
7 votes

WFS Intersect Filter using a Polygon returns all features in Layer

You are using WFS 1.0.0. That WFS version is using Filter Encoding Standard 1.0.0 http://portal.opengeospatial.org/files/?artifact_id=1171 and there is indeed a typo in the standard. On page 17 the ...
  • 59k
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 ...
7 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", "...
  • 9,835
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-...
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-...

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