[Gvsig_english] Expression to calculate a field

David L dleclair at centre-du-quebec.qc.ca
Fri Jan 21 18:09:12 CET 2011


Hi!

I'm using gvSIG to calculate crop area. i draw polygon then i calculate a
field (float) to obtain the area in hectares rather then square meters, with
2 decimals. 

Actually the function round(), doesn't accept a number of decimal in
parameter. 
So I use this formula :

round(area()/100)/100

suppose that area() = 34899.993 m2
According to mathematical rules: 
round(34899.993/100)/100
round(348.99993)/100
349/100
3.49 ha

in fact the expression return 3 ha

is it a bug, or maybe i don't understand how the calculating expression
behaves.

I found a way to bypass this, calculating in 2 consecutives expressions. 
round(area()/100)

then
[area_ha]/100

I tought that this could be correct in a next revision and it would be great
to directly assign a number of decimals at the round() function. 
round((area()/10000),2)

regards

David





-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Expression-to-calculate-a-field-tp5948503p5948503.html
Sent from the gvSIG international mailing list archive at Nabble.com.


More information about the Gvsig_internacional mailing list