[MapServer-users] NULL-EXPRESSION

Björn Danielsson bjorn.danielsson1946 at outlook.com
Sat Mar 29 02:13:30 PDT 2025


It was at least 5 years since I struggled with this.
The map should show a gradient with values like 0, 1-19, 20-39 and so on.
A lot of classes, and I found out that records with a column with null value were returned  as value 0 and therefore ended up in
class expression ( x = [0]) together with real values = 0.
That is why I created two layers with the same name as I described in my first mail.
However, if you have no need to differ between 0 and null I think you can either have a class with expression ( x=[0]), or perhaps as Richard G suggested
no expression at all, which would be simplest.

Björn D
________________________________
Från: MapServer-users <mapserver-users-bounces at lists.osgeo.org> för Richard Greenwood via MapServer-users <mapserver-users at lists.osgeo.org>
Skickat: den 28 mars 2025 16:19
Kopia: angelique.kroisl at stadt-koeln.de <angelique.kroisl at stadt-koeln.de>; MapServer Users <mapserver-users at lists.osgeo.org>
Ämne: Re: [MapServer-users] NULL-EXPRESSION

Have you tried making your CLASS for NULLs the last of the three classes and with no EXPRESSION? The first two classes would pick up 2000 and 2100 and then anything not matching would be in the third class. This works in most cases but I haven't tried it with NULLs.

Rich

On Fri, Mar 28, 2025 at 4:36 AM Björn Danielsson via MapServer-users <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>> wrote:
This works for me.
Try this:

Create two layers with the same name and group.

Layer 1 ( takes care of values 2000 and 2100) :
LAYER
    NAME  "A"
   GROUP "A"
   .....

   PROCESSING 'NATIVE_FILTER=gst IS NOT NULL'

  CLASS for 2000
....

  CLASS for 2100
....

END

Layer 2 ( value = NULL ) ❤️

LAYER
   NAME  "A"
   GROUP "A"
   ....

  PROCESSING 'NATIVE_FILTER=gst IS NULL'

 CLASS for NULL
....

END


________________________________
Från: MapServer-users <mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>> för Seth G via MapServer-users <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
Skickat: den 28 mars 2025 10:43
Till: angelique.kroisl at stadt-koeln.de<mailto:angelique.kroisl at stadt-koeln.de> <angelique.kroisl at stadt-koeln.de<mailto:angelique.kroisl at stadt-koeln.de>>; MapServer Users <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
Ämne: Re: [MapServer-users] NULL-EXPRESSION

Hi,

Unfortunately, MapServer doesn't have a NULL type.
The workaround is to create a database view or query that will set the NULL to a numeric value of your choosing, e.g. -1 and then use that value in the CLASS expressions.

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika at mastodon.social<mailto:geographika at mastodon.social>

On Fri, Mar 28, 2025, at 8:55 AM, Angelique Kroisl via MapServer-users wrote:

Hello,

I'm trying to create a class using the class item "gst."

The attribute in the database can only have three values (2000, 2100, and <NULL>).

Unfortunately, I can't create the NULL EXPRESSION.



I've already tried the following:

EXPRESSION IS NULL



EXPRESSION "<NULL>"



EXPRESSION <NULL>



EXPRESSION EMPTY



What is the correct syntax for this?


________________________________



Monatlich aktuelle Informationen Ihrer Stadtverwaltung in unserem Newsletter! Newsletter Anmeldung<https://www.stadt-koeln.de/service/onlinedienste/newsletter-anmeldung?para=allgemein>
________________________________




[X]<https://www.stadt-koeln.de/leben-in-koeln/freizeit-natur-sport/veranstaltungskalender/lidl-final4-dhb-pokal>
_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users


_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users


--
Richard W. Greenwood
www.greenwoodmap.com<http://www.greenwoodmap.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20250329/3f7a7368/attachment-0001.htm>


More information about the MapServer-users mailing list