[Qgis-user] Filtering NULL values from WFS

Reetz, Michael (NLPVW) Michael.Reetz at nlpvw.niedersachsen.de
Wed Sep 3 01:52:51 PDT 2025


Hello group,

I've found a solution for my filtering problem. As said in the filter dialog, a WFS filter expression has to be defined. A lot of searching and testing resulted in the following expression:

<Filter><PropertyIsNil><PropertyName>STOP_PS</PropertyName></PropertyIsNil></Filter>

Additional clauses can be added following this syntax (example for responsible authority):

<Filter>
	<And>
		<PropertyIsEqualTo><PropertyName>RESPONSIBILITY</PropertyName><Literal>NLWKN</Literal></PropertyIsEqualTo>
		<PropertyIsNil><PropertyName>STOP_PS</PropertyName></PropertyIsNil>
	</And>
</Filter>


Thanks again and best regards

Michael

-----Ursprüngliche Nachricht-----
Von: QGIS-User <qgis-user-bounces at lists.osgeo.org> Im Auftrag von Reetz, Michael (NLPVW) via QGIS-User
Gesendet: Mittwoch, 27. August 2025 08:10
An: pathmapper <pathmapper at posteo.de>
Cc: qgis-user <qgis-user at lists.osgeo.org>
Betreff: Re: [Qgis-user] Filtering NULL values from WFS

ACHTUNG!! Diese E-Mail erreicht Sie von einem Absender außerhalb der niedersächsischen Landesverwaltungs-Infrastruktur mit TLS-Verschlüsselung. Bitte klicken Sie auf keine Links oder öffnen Sie keine E-Mail-Anhänge, falls Sie den Absender nicht kennen und nicht wissen, ob der Inhalt sicher ist.
The WFS URL is https://geoportal.bafg.de/arcgis3/services/MUDAB/MUDAB_Monitoringstationen/MapServer/WFSServer

The layer is "Alle_Projektstationen" and the attribute is "STOP_PS". I called it "end_date" in my mail because that is its meaning.
 

-----Ursprüngliche Nachricht-----
Von: pathmapper <pathmapper at posteo.de>
Gesendet: Mittwoch, 27. August 2025 07:47
An: Reetz, Michael (NLPVW) <Michael.Reetz at nlpvw.niedersachsen.de>
Cc: chris hermansen <clhermansen at gmail.com>; qgis-user <qgis-user at lists.osgeo.org>
Betreff: Re: [Qgis-user] Filtering NULL values from WFS

ACHTUNG!! Diese E-Mail erreicht Sie von einem Absender außerhalb der niedersächsischen Landesverwaltungs-Infrastruktur mit TLS-Verschlüsselung. Bitte klicken Sie auf keine Links oder öffnen Sie keine E-Mail-Anhänge, falls Sie den Absender nicht kennen und nicht wissen, ob der Inhalt sicher ist.
Michael, can you provide the WFS URL?

On 27.08.2025 07:31, Reetz, Michael (NLPVW) via QGIS-User wrote:
> Dear Chris and Björn,
> 
> yes, I have tried end_date is null first. No records are found with 
> this although most record have NULL as end_date.
> 
> Cheers,
> 
> Michael
> 
> VON: chris hermansen <clhermansen at gmail.com>
>  GESENDET: Dienstag, 26. August 2025 17:45
>  AN: Reetz, Michael (NLPVW) <Michael.Reetz at nlpvw.niedersachsen.de>
>  CC: qgis-user <qgis-user at lists.osgeo.org>
>  BETREFF: Re: [Qgis-user] Filtering NULL values from WFS
> 
> ACHTUNG!! Diese E-Mail erreicht Sie von einem Absender außerhalb der 
> niedersächsischen Landesverwaltungs-Infrastruktur mit 
> TLS-Verschlüsselung. Bitte klicken Sie auf keine Links oder öffnen Sie 
> keine E-Mail-Anhänge, falls Sie den Absender nicht kennen und nicht 
> wissen, ob der Inhalt sicher ist.
> 
> Michael and list
> 
> On Tue, Aug 26, 2025, 07:54 Reetz, Michael (NLPVW) via QGIS-User 
> <qgis-user at lists.osgeo.org> wrote:
> 
>> Hello group,
>> 
>> I’ve added a WFS-layer to a project try to define filters on 
>> different attributes. It seems not to be possible to filter for NULL 
>> values.
>> 
>> Example:
>> 
>> * 1932 records in total
>> * 376 records with a value in a date attribute
>> * 20 records with 2005-12-31 as value
>> 
>> If I set the filter to "end_date" = '2005-12-31' the result is 20 
>> records.
>> 
>> If I set the filter to "end_date" != '2005-12-31' the result is 356 
>> records. So only records that have an end date are recognized.
>> Record with NULL as end date are ignored.
>> 
>> Filtering in the attribute table with “is_empty_or_null” works but 
>> only for selection.
>> 
>> Is this “normal” behaviour with WFS layers or is there a way to 
>> define a filter string that work for all records?
> 
> Have you tried
> 
> end_date IS NULL
> 
> Generally speaking (I'm not sure about this specific case) null is 
> neither equal nor unequal hence the need for a different logical 
> operator, IS.
> 
> Can you combine conditions for example
> 
> end_date IS NULL or end_date = '2005-12-31'
> 
> 
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
QGIS-User mailing list
QGIS-User at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the QGIS-User mailing list