<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Jesper,<br></div><div><br></div><div>This looks like a bug - it should work as you expect it to.<br></div><div>Could you log an issue at <a href="https://github.com/MapServer/MapServer/issues">https://github.com/MapServer/MapServer/issues</a> ?<br></div><div><br></div><div>Seth<br></div><div><br></div><div id="sig62266145"><div class="signature">--<br></div><div class="signature">web:<a href="https://geographika.net">https://geographika.net</a> & <a href="https://mapserverstudio.net">https://mapserverstudio.net</a><br></div><div class="signature">mastodon: @<a href="mailto:geographika@mastodon.social">geographika@mastodon.social</a><br></div></div><div><br></div><div>On Wed, Feb 12, 2025, at 3:13 PM, Jesper Kempe via MapServer-users wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="ltr"><div>Hi<br></div><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.<br></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.<br></div><div>But I cant get it to work. Nothing is shown in the map.<br></div><div><br></div><div>Should it be possible to use a scaletoken in a filter expresssion?<br></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?<br></div><div><br></div><div>Now I get errors like this in the log file:<br></div><div><br></div><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></div><div>[Wed Feb 12 13:50:20 2025].24460 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined.<br></div><div>[Wed Feb 12 13:50:20 2025].24474 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined.<br></div><div>[Wed Feb 12 13:50:20 2025].24482 msEvalExpression(): General error message. Cannot evaluate expression, no item index defined. <br></div><div><br></div><div>Using this mapfile:<br></div><div><div>MAP<br></div><div> CONFIG "MS_ERRORFILE" "ms_error.txt"<br></div><div><br></div><div> STATUS ON<br></div><div><br></div><div> PROJECTION<br></div><div> "init=epsg:4326"<br></div><div> END<br></div><div><br></div><div> EXTENT -180 -90 180 90<br></div><div><br></div><div> WEB<br></div><div> METADATA<br></div><div> "wms_title" "WMS Demo Server"<br></div><div> "wms_srs" "EPSG:4326"<br></div><div> "wms_enable_request" "*"<br></div><div> END<br></div><div> END<br></div><div><br></div><div> LAYER<br></div><div> DEBUG 5<br></div><div> NAME 'ne_10m_lakes'<br></div><div><br></div><div> TYPE POLYGON<br></div><div> PROJECTION<br></div><div> "init=epsg:4326"<br></div><div> END<br></div><div> EXTENT -180 -90 180 90<br></div><div> DATA "ne_10m_lakes.shp"<br></div><div><br></div><div> SCALETOKEN<br></div><div> NAME "%ne_scalerank%"<br></div><div> VALUES<br></div><div> "0" "10"<br></div><div> "1000" "8"<br></div><div> "10000000" "5"<br></div><div> END # VALUES<br></div><div> END # SCALETOKEN<br></div><div><br></div><div> FILTER ([scalerank] < %ne_scalerank% )<br></div><div><br></div><div> CLASS<br></div><div> STYLE<br></div><div> OUTLINECOLOR "#647078"<br></div><div> WIDTH 1<br></div><div> COLOR "#EBEEF0"<br></div><div> END<br></div><div> END<br></div><div><br></div><div> END<br></div><div><br></div><div>END<br></div></div><div><br></div><div>For this request<br></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><br></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.<br></div><div><br></div><div>Anyone with thoughts or ideas on how this can be solved?<br></div><div><br></div><div>I am on Mapserver 7.6.4. <br></div><div><br></div><div>Thanks,<br></div><div>Jesper<br></div><div><br></div></div><div>_______________________________________________<br></div><div>MapServer-users mailing list<br></div><div><a href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></div><div><br></div></blockquote><div><br></div></body></html>