<div dir="ltr">Hi<div><br></div><div>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 <a href="https://www.naturalearthdata.com/downloads/10m-physical-vectors/">https://www.naturalearthdata.com/downloads/10m-physical-vectors/</a>) using the attribute scalerank in the shape file.</div><div><br></div><div>My plan was to use SCALETOKEN to replace the value in a FILTER with the current max scalerank to use.</div><div>But I cant get it to work. Nothing is shown in the map.</div><div><br></div><div>Should it be possible to use a scaletoken in a filter expresssion?</div><div><br></div><div>Looking at <a href="https://mapserver.org/development/rfc/ms-rfc-86.html#discussion">https://mapserver.org/development/rfc/ms-rfc-86.html#discussion</a> it looks like it at least was planned to work?</div><div><br></div><div>Now I get errors like this in the log file:</div><div><br></div>[Wed Feb 12 13:50:20 2025].23938 replacing scaletoken (%ne_scalerank%) with (5) in layer->filter (ne_10m_lakes) for scale=221471921.250000<br>[Wed Feb 12 13:50:20 2025].24460 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined.<br>[Wed Feb 12 13:50:20 2025].24474 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined.<br><div>[Wed Feb 12 13:50:20 2025].24482 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined. </div><div><br></div><div>Using this mapfile:</div><div>MAP<br>    CONFIG "MS_ERRORFILE" "ms_error.txt"<br><br>    STATUS ON<br><br>    PROJECTION<br>        "init=epsg:4326"<br>    END<br><br>    EXTENT -180 -90 180 90<br><br>    WEB<br>        METADATA<br>            "wms_title"           "WMS Demo Server"<br>            "wms_srs"             "EPSG:4326"<br>            "wms_enable_request"  "*"<br>        END<br>    END<br><br>    LAYER<br>        DEBUG 5<br>        NAME 'ne_10m_lakes'<br><br>        TYPE POLYGON<br>        PROJECTION<br>            "init=epsg:4326"<br>        END<br>        EXTENT -180 -90 180 90<br>        DATA "ne_10m_lakes.shp"<br><br>        SCALETOKEN<br>            NAME "%ne_scalerank%"<br>            VALUES<br>                "0" "10"<br>                "1000" "8"<br>                "10000000" "5"<br>            END # VALUES<br>        END # SCALETOKEN<br><br>        FILTER ([scalerank] < %ne_scalerank% )<br><br>        CLASS<br>            STYLE<br>                OUTLINECOLOR "#647078"<br>                WIDTH 1<br>                COLOR "#EBEEF0"<br>            END<br>        END<br><br>    END<br><br>END</div><div><br></div><div>For this request</div><div><a href="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">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</a></div><div><br></div><div>Worth noting is if I replace FILTER ([scalerank] < %ne_scalerank% ) with FILTER ([scalerank] < 5 ) in the mapfile it works fine.</div><div><br></div><div>Anyone with thoughts or ideas on how this can be solved?</div><div><br></div><div>I am on Mapserver 7.6.4. </div><div><br></div><div>Thanks,</div><div>Jesper</div><div><br></div></div>