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

Function getFieldCenter

src/components/WeatherView.tsx:114–119  ·  view source on GitHub ↗
(field: Field)

Source from the content-addressed store, hash-verified

112};
113
114function getFieldCenter(field: Field) {
115 const coords = field.coordinates[0];
116 const lat = coords.reduce((sum, c) => sum + c[1], 0) / coords.length;
117 const lng = coords.reduce((sum, c) => sum + c[0], 0) / coords.length;
118 return { lat, lng };
119}
120
121interface WeatherViewProps {
122 activeField: Field | null;

Callers 4

fetchSoilFunction · 0.70
fetchLiveFunction · 0.70
fetchAqiFunction · 0.70
fetchWeatherDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected