[mapserver-users] How can I avoid long notation of double values in label or info template for shapes?

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Sun Nov 25 17:54:54 PST 2012


For completeness in a template you can use the item tag, e.g.:

  [item name="foo" precision="2"]

There is also a commify option to make big numbers look nicer. (e.g. 2,123.23)

Steve

________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] on behalf of Astrid Emde [astrid.emde at wheregroup.com]
Sent: Friday, November 23, 2012 4:04 AM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?

Am 23.11.2012 10:39, schrieb Lars Lingner:
> On 23.11.2012 10:12, Astrid Emde wrote:
>> Hello,
>>
>> I have a shapefile with a column of type double that contains values
>> like 2.54 or -2.03.
>>
>> When I label the geometrie with this column or display this column in
>> my infotemplate I get the following notation of the values:
>> 2.54000000000e+000 -2.03000000000e+000
>>
>> If there a way to tell MapServer to display the "normal" notation of
>> the value? Or do I have to change the shape?
>>
> You can define your own format by using
>
> ...
> CLASS
>   ...
>   TEXT (round[numbercolumn], 2)
>   ...
>   LABEL
>     ...
>   END
> END
> ...
>
> In RFC 64 [1] you'll find some informations.
>
> I'm pretty sure I used it for myself. But grepping through my current
> mapfiles say otherwise. So I can't give an working example.
>
>
> Lars
>
>
> [1] http://mapserver.org/development/rfc/ms-rfc-64.html
Hi Lars,

thanks for the information!

It works fine for the label.

Before I defined LABELITEM mycolumn and got  the long notation:
2.54000000000e+000

with definition TEXT mycolumn the label looks fine (without using any
function): 2.54

Is there a solution for the query result too?

Astrid


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list