[MapServer-users] How to format labels on contours

Trygve Aspenes trygve at aspenes.priv.no
Fri Oct 20 12:16:21 PDT 2023


Hi

So I have made a contour plot from a raster. Works nicely.
Then I added labels to give context to the contours. Fine.
Now I want to format the labels.

I have found this post 
https://gis.stackexchange.com/questions/350089/round-number-for-label-in-mapserver 
suggesting a syntax:
TEXT (tostring(([SQKM]),"%.0f")+" km2")

Nice, but I use mapscript. And I do not understand nor find any examples 
how I could do this with mapscript
I tried with:
s = mapscript.classObj(layer)
<other style and label stuff>
s.updateFromString('TEXT (tostring(([SQKM]),"%.0f")+" km2")')

But I get:
EOFError: loadClass(): Premature End-of-File.

So obviously not correct.

Is there someone who could suggest what could be wrong here or what else 
to look at and try?

Trygve Aspenes



More information about the MapServer-users mailing list