Hi,

I am trying to round the number of decimals from my data for labeling (which is 
shown as BigDecimal on geoserver admin interface with postgis datastore). I 
have looked at the following resources, but couldn't find a solution.

http://www.mail-archive.com/[email protected]/msg00940.html
http://docs.geoserver.org/latest/en/user/filter/function_reference.html
https://groups.google.com/forum/?fromgroups=#!topic/geoext-users-archive/I4N6eu-C-4Q
http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html

Simply put, I have 149.999999999 in my data and want to have something like 
149.9 or 150.0 for my labels. Is there any easier way to do the formatting with 
number functions or do I have to only use string functions like strSubstring 
etc?. 

Here is a snippet of sld if you want to look at it.

            <ogc:Function name="if_then_else">
               <ogc:Function name="isNull">
                 <ogc:PropertyName>MYFIELD</ogc:PropertyName>
               </ogc:Function>
               <ogc:Literal></ogc:Literal>
                <ogc:Function name="Concatenate">
                 <ogc:Literal><![CDATA[ Custom Text ]]></ogc:Literal>
                 <ogc:Function name="numberFormat">
                   <ogc:Literal>#.#</ogc:Literal>
                   <ogc:PropertyName>MYFIELD</ogc:PropertyName>
                 </ogc:Function>
               </ogc:Function>  
           </ogc:Function> 

I also tried publishing shapefile (which is shown as Double on geoserver admin 
interface) and no luck.

Thanks,
Ravi.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to