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

Lars Lingner gislars+list at googlemail.com
Fri Nov 23 05:30:59 PST 2012


> 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




More information about the MapServer-users mailing list