FW: [mapserver-users] display labels as an integer instead of scientific notations [SEC=UNCLASSIFIED]

Kathleen Hirst K.Hirst at bom.gov.au
Thu Jul 28 17:56:55 PDT 2011


Hi Mark,

You can use an OGR connection for formatting of number fields when labelling in MapServer version 5.x. I think you need GDAL 1.6 or later.

For example with a shapefile called test.shp with a field, testfld1, you can do the following to show only two decimal places.

LAYER
   ..
   CONNECTIONTYPE OGR
   CONNECTION "test.shp"
   DATA "select CAST(testfld1 AS numeric (4,2)) from test"
   ..
   CLASS
       ...
       TEXT ([testfld1)]
       LABEL
        ..
       END
   END
END

Regards,

Kathleen

________________________________
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Mark Volz
Sent: Thursday, 28 July 2011 5:26 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] display labels as an integer instead of scientific notations.

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

Thanks

Mark



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110729/337c1624/attachment.htm>


More information about the MapServer-users mailing list