Hi all,
I run the "area (with strategy)" example shown on
I'm interested in getting the geodetic area (the second one of the code below)
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
namespace bg = boost::geometry;
int main()
{
// Calculate the area of a spherical polygon (for latitude: 0 at equator)
bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
double area = bg::area(sph_poly);
std::cout << "Area: " << area << std::endl;
return 0;
}
The code above prints out:
Area: 0.339837
In this case, what is the unit of the area?
The documentation states that:
Returns the area on a unit sphere (or another sphere, if specified as such in the constructor of the strategy)
Sorry, but my knowledge of geography is limited.
How can I transform that number to square kilometers, square miles, ...?
Thank you very much.
Regards,
Fernando Pelliccioni.