[mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
Astrid Emde
astrid.emde at wheregroup.com
Fri Nov 23 06:25:32 PST 2012
Am 23.11.2012 14:30, schrieb Lars Lingner:
>> 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?
>>
> I assume that you cant use any of these functions in your template file.
> Would be nice if I'm wrong.
>
> An workaround could be to use the ogr connection type. This way, you can
> access and modify your features/attributes with SQL.
>
> Look at example #4 here [1]. I think you can use "SELECT ...,
> round(numbercolumn,2) as mycolumn FROM..." here.
>
> But than... if the performance isn't good enough, it might me worth to
> just preprocess the shape files. Or put them in a database to be more
> flexibel.
>
>
> Lars
>
>
> [1]
> http://mapserver.org/input/vector/ogr.html#examples-of-layer-definitions-using-ogr
>
> ____________
Hi Lars,
again - thanks for your answer. I got a solution.
CONNECTIONTYPE OGR
CONNECTION "double_test.shp"
DATA "Select *, J_2010_201*1 as newcolumn from double_test"
The function round(numbercolumn,2) was not found but with multiplication by 1 it works.
Astrid
More information about the MapServer-users
mailing list