Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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²)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading