Andrea,

Thanks for the tip and it solved my problem.  


Thanks!
Ravi.




________________________________
 From: Andrea Aime <andrea.a...@geo-solutions.it>
To: Ravi Pavuluri <ravith...@ymail.com> 
Cc: Geoserver-users <geoserver-users@lists.sourceforge.net> 
Sent: Thursday, October 25, 2012 2:28 PM
Subject: Re: [Geoserver-users] SLD - Decimal Roundup -Labeling
 
On Thu, Oct 25, 2012 at 7:30 PM, Ravi Pavuluri <ravith...@ymail.com> wrote:
> 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/geoserver-users@lists.sourceforge.net/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>

Have you tried using #.0 instead of #.# ?

Cheers
Andrea


-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
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
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to