Re: [mapserver-users] [SOLVED] Re: Filtering NULL values from Postgis Layer in Mapserver 7
Lime, Steve D (MNIT) wrote >> It still would be very nice to have an option to ignore empty fields/ >> NULL >> values/ missing values like - 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 Steve, I see you point. With the FILTER or native_filter PROCESSING option and careful management of the FILTER expression one can achieve a proper filtering of missing values. On the other hand it would be very convenient (imo) to have a setting on LAYER level (or even one at MAP level which can be overridden on LAYER level) like: MISSING_VALUE [string] where [string] then can be "EMPTY" "NULL" "-" or whatever. The desired behaviour would then be that every expression where the MISSING_VALUE appears is always evaluated as false. MArco -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-NULL-values-from-Postgis-Layer-in-Mapserver-7-tp5280893p5281457.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] [SOLVED] Re: Filtering NULL values from Postgis Layer in Mapserver 7
> It still would be very nice to have an option to ignore empty fields/ NULL > values/ missing values like - 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-boun...@lists.osgeo.org] On Behalf Of deduikertjes Sent: Thursday, August 18, 2016 3:34 AM To: mapserver-users@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 - 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[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 - 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users