MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / calculateAreaAcres

Function calculateAreaAcres

src/components/NewFieldDialog.tsx:48–59  ·  view source on GitHub ↗
(coords: [number, number][])

Source from the content-addressed store, hash-verified

46];
47
48function calculateAreaAcres(coords: [number, number][]): number {
49 let area = 0;
50 const n = coords.length;
51 for (let i = 0; i < n; i++) {
52 const j = (i + 1) % n;
53 area += coords[i][0] * coords[j][1];
54 area -= coords[j][0] * coords[i][1];
55 }
56 area = Math.abs(area) / 2;
57 area = (area * 111000 * 85000) / 4046.86;
58 return Math.round(area * 10) / 10;
59}
60
61interface NewFieldDialogProps {
62 coordinates: [number, number][];

Callers 1

NewFieldDialogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected