[mapserver-users] [SOLVED] Re: Filtering NULL values from Postgis Layer in Mapserver 7

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Fri Aug 19 11:46:02 PDT 2016


> It still would be very nice to have an option to ignore empty fields/ NULL
> values/ missing values like -9999 with a single config option. Shall I file
> a feature request for that?

How would such a feature be different than FILTER or the native_filter PROCESSING option? Just trying to understand what convenience we might be able to introduce. --Steve

-----Original Message-----
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of deduikertjes
Sent: Thursday, August 18, 2016 3:34 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] [SOLVED] Re: Filtering NULL values from Postgis Layer in Mapserver 7

Steve, 

thank you


Lime, Steve D (MNIT) wrote
> The filter option is still there - it's just implemented as a processing
> option instead. So what was:
> 
>   FILTER 'myitem != NULL'
> 
> Becomes:
> 
>   PROCESSING 'NATIVE_FILTER=myitem != NULL'
>   
> Steve  

I can confirm that making the FILTER a PROCESSING option indeed works, even
with runtime substitution. (using = NULL does not work, IS NULL must be
used)

So the mapserver6 style line:
   FILTER (NOT (%MY_VAR1% IS NULL OR %MY_VAR2% IS NULL)) 
in mapserver 7 becomes:
   PROCESSING 'NATIVE_FILTER=(NOT (%MY_VAR1% IS NULL OR %MY_VAR2% IS NULL))'

So I summarize:
   - CLASS EXPRESSIONS will treat NULL values in numerical fields as zero
(and I presume it does the same for empty numeric fields in shapefiles). It
is not possible to prevent this behaviour.
   - To prevent NULL values from being rendered a FILTER must be applied, or
a subselect in the DATA statement must be used.
   - In mapserver 6 that can be a native filter with a syntax like FILTER
(NOT (%MY_VAR1% IS NULL OR %MY_VAR2% IS NULL)) 
   - In mapserver 7 that filter must be added as a processing option with a
syntax like PROCESSING 'NATIVE_FILTER=(NOT (%MY_VAR1% IS NULL OR %MY_VAR2%
IS NULL))'

It still would be very nice to have an option to ignore empty fields/ NULL
values/ missing values like -9999 with a single config option. Shall I file
a feature request for that?

MArco




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-NULL-values-from-Postgis-Layer-in-Mapserver-7-tp5280893p5281145.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list