Hi Jesper.
The only thing I see at a first glance is the filter run-time
substitution missing ''. See documentation how it is done there
https://mapserver.org/cgi/runsub.html#filters
Not sure if this is your problem, but maybe worth a try.
Trygve
Den 2025-02-12 15:13, skrev Jesper Kempe via MapServer-users:
Hi
I am trying to show different levels of details based on zoom level in
a map based on Natural earth 10m data (ne_10m_lakes.zip from
https://www.naturalearthdata.com/downloads/10m-physical-vectors/)
using the attribute scalerank in the shape file.
My plan was to use SCALETOKEN to replace the value in a FILTER with
the current max scalerank to use.
But I cant get it to work. Nothing is shown in the map.
Should it be possible to use a scaletoken in a filter expresssion?
Looking at
https://mapserver.org/development/rfc/ms-rfc-86.html#discussion it
looks like it at least was planned to work?
Now I get errors like this in the log file:
[Wed Feb 12 13:50:20 2025].23938 replacing scaletoken (%ne_scalerank%)
with (5) in layer->filter (ne_10m_lakes) for scale=221471921.250000
[Wed Feb 12 13:50:20 2025].24460 msEvalExpression(): General error
message. Cannot evaluate expression, no item index defined.
[Wed Feb 12 13:50:20 2025].24474 msEvalExpression(): General error
message. Cannot evaluate expression, no item index defined.
[Wed Feb 12 13:50:20 2025].24482 msEvalExpression(): General error
message. Cannot evaluate expression, no item index defined.
Using this mapfile:
MAP
CONFIG "MS_ERRORFILE" "ms_error.txt"
STATUS ON
PROJECTION
"init=epsg:4326"
END
EXTENT -180 -90 180 90
WEB
METADATA
"wms_title" "WMS Demo Server"
"wms_srs" "EPSG:4326"
"wms_enable_request" "*"
END
END
LAYER
DEBUG 5
NAME 'ne_10m_lakes'
TYPE POLYGON
PROJECTION
"init=epsg:4326"
END
EXTENT -180 -90 180 90
DATA "ne_10m_lakes.shp"
SCALETOKEN
NAME "%ne_scalerank%"
VALUES
"0" "10"
"1000" "8"
"10000000" "5"
END # VALUES
END # SCALETOKEN
FILTER ([scalerank] < %ne_scalerank% )
CLASS
STYLE
OUTLINECOLOR "#647078"
WIDTH 1
COLOR "#EBEEF0"
END
END
END
END
For this request
https://myserver/wms?&service=WMS&request=GetMap&layers=ne_10m_lakes&styles=&format=image%2Fpng&transparent=false&version=1.1.1&map=ne_10m_lakes.map&height=512&width=512&srs=EPSG%3A4326&bbox=-180,-90,180,90
[1]
Worth noting is if I replace FILTER ([scalerank] < %ne_scalerank% )
with FILTER ([scalerank] < 5 ) in the mapfile it works fine.
Anyone with thoughts or ideas on how this can be solved?
I am on Mapserver 7.6.4.
Thanks,
Jesper
Links:
------
[1]
https://myserver/wms?&service=WMS&request=GetMap&layers=ne_10m_lakes&styles=&format=image%2Fpng&transparent=false&version=1.1.1&map=ne_10m_lakes.map&height=512&width=512&srs=EPSG%3A4326&bbox=-180,-90,180,90
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users