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

Havard Tveite havard.tveite at umb.no
Fri Nov 23 02:26:45 PST 2012


According to http://www.mapserver.org/mapfile/class.html

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

could also be used.

round and tostring are documented in http://www.mapserver.org/mapfile/expressions.html

round ( n1 , n2 )

tostring ( n1, "Format1" )

Håvard

On 11/23/2012 10:39 AM, Lars Lingner wrote:
> 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
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>

-- 
Håvard Tveite
Department of Mathematical Sciences and Technology, UMB
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/


More information about the mapserver-users mailing list