[mapserver-users] display labels as an integer instead of scientific notations.

Daniel Morissette dmorissette at mapgears.com
Wed Jul 27 15:54:45 EDT 2011


On 11-07-27 03:25 PM, Mark Volz wrote:
> Hello,
> I have a label that displays a number in scientific notation; for
> example 2.08+e002. I would like the label to display as an integer such
> as 2.08. In the past I asked a similar question about HTML templates and
> someone mentioned that I should use “[item name="area" precision=2]”
> Unfortunately, the statement seems invalid as a label in the .map file.
> Does anyone know how I can display a number as an integer? Or will I
> have to convert all my values to Text? I am using mapserver 5.4

I don't think there was any way to format numeric labels in version 5.x 
and older.

However, MapServer 6.0 (RFC 64) introduced a toString() function that 
can be used in labels as follows:

       TEXT ("[area]")

       TEXT (tostring([area],"%.2f"))

       TEXT ("Area is: " + tostring([area],"%.2f"))


-- 
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000



More information about the mapserver-users mailing list