area function
Takes a GeoJSONObject and returns their area in square meters.
Feature<Polygon> poly = Feature<Polygon>(
geometry: Polygon(coordinates: [
[
Position(125, -15),
Position(113, -22),
Position(117, -37),
Position(130, -33),
Position(148, -39),
Position(154, -27),
Position(144, -15),
Position(125, -15)
]
]),
);
var area = turf.area(polygon);
Implementation
num? area(GeoJSONObject geojson) {
return geomReduce<num>(geojson, (value, geom, _, __, ___, ____) {
return value! + _calculateArea(geom!);
}, 0);
}