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

Mark Volz MarkVolz at co.lyon.mn.us
Fri Jul 29 09:27:40 EDT 2011


Kathleen,

That works quite well Thank you!

Mark Volz
GIS Specialist
Lyon County, MN
507-532-8218

From: Kathleen Hirst [mailto:K.Hirst at bom.gov.au]
Sent: Thursday, July 28, 2011 7:57 PM
To: Mark Volz
Cc: mapserver-users at lists.osgeo.org
Subject: FW: [mapserver-users] display labels as an integer instead of scientific notations [SEC=UNCLASSIFIED]

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/37f2cff2/attachment.html


More information about the mapserver-users mailing list