[OpenLayers-Users] limit decimal numbers

Jon Blower jdb at mail.nerc-essc.ac.uk
Mon Sep 15 06:20:20 EDT 2008


Hi Alessio,

JavaScript 1.5+ has a toFixed() method to format numbers to a certain
number of decimal places and a corresponding toPrecision() method to
format using a certain number of significant figures.

http://www.pageresource.com/jscript/j_a_03.htm

Cheers, Jon


---------- Forwarded message ----------
From: Alessio Di Lorenzo <alessio.dilorenzo at gmail.com>
To: users at openlayers.org
Date: Mon, 15 Sep 2008 02:10:19 -0700 (PDT)
Subject: [OpenLayers-Users] limit decimal numbers

Hi list,

I created a function returning the current map extent and updating values
every time the user pan or zoom the map.

The function works fine and the effect is what I was looking for, but now I
need to control how many decimal numbers appear after the comma separator.
For example I want to display always 5 decimal numbers after the comma...
There's a way to do such thing?

Thanks, alessio

-- 
Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower at reading.ac.uk
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm



More information about the Users mailing list