Hi Jesper, As a workaround (unless this was the intended design), you can use the following approach:
SCALETOKEN NAME "%ne_scalerank%" VALUES "0" "([scalerank] < 10)" "1000" "([scalerank] < 8)" "10000000" "([scalerank] < 5)" END END FILTER "%ne_scalerank%" Seth -- web:https://geographika.net & https://mapserverstudio.net mastodon: @geographika@mastodon.social On Thu, Feb 13, 2025, at 12:31 PM, Seth G via MapServer-users wrote: > Hi Jesper, > > This looks like a bug - it should work as you expect it to. > Could you log an issue at https://github.com/MapServer/MapServer/issues ? > > Seth > > -- > web:https://geographika.net & https://mapserverstudio.net > mastodon: @geographika@mastodon.social > > On Wed, Feb 12, 2025, at 3:13 PM, Jesper Kempe via MapServer-users wrote: >> 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 >> >> 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 >> >> _______________________________________________ >> 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 >
_______________________________________________ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users