Konat Undoshy
Konat Undoshy

Reputation: 421

Area of Boost c++ in Square Meters

I have a

boost::geometry::model::polygon<Point> Algorithm::poly

and i'm looking for the area of the polygon with

area = bg::area(poly);

the result is

1.10434e+08

When i'm reading the documentation, i can see "The units are the square of the units used for the points defining the surface". I really don't understand what it means. https://www.boost.org/doc/libs/1_65_0/libs/geometry/doc/html/geometry/reference/algorithms/area/area_1.html

I would like to know if we have a way to transform the return of the bg::area in a m2 result.

With another tool (i can't use it in my code) i can see that the total of m2 from the polygon is 11043 m2. How can i have 11043 with 1.10434e+08.

Upvotes: 1

Views: 81

Answers (1)

peterchen
peterchen

Reputation: 41096

The points in polyare cartesian (x,y) coordinates. What is their unit? are they in mm, cm, attoparsec?

The resulting unit is the square of that. But we can work that out from the data given:

sqrt(1.1043e+08 / 11043) = srqt(10000) = 100

So it seems your points are in 0.01 m == centimeter, so the area returned is in cm²

(1m² = 10000cm²)

Upvotes: 2

Related Questions