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

Function fetchGee

src/components/FieldComparisonColumn.tsx:96–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94 setGeeData(cached);
95 return;
96 }
97 const fetchGee = async () => {
98 setGeeLoading(true);
99 try {
100 const polygon = field.coordinates[0];
101 const { data, error } = await callBackend("gee-analytics", { polygon, analyses: ["land_use", "vegetation", "suitability"] });
102 if (error) throw error;
103 if (hasGeeAnalyticsPayload(data)) {
104 setGeeData(data);
105 setLocalCache(GEE_ANALYTICS_CACHE_KEY, field.id, data);
106 } else if (isFallbackPayload(data)) {
107 setGeeData(cached ?? null);
108 } else {
109 setGeeData(null);
110 }
111 } catch (e) {
112 console.error("GEE analytics error:", e);
113 setGeeData(cached ?? null);
114 } finally { setGeeLoading(false); }
115 };
116 fetchGee();
117 }, [field.id]);
118
119 // Fetch NDVI time-series

Callers 1

FieldComparisonColumnFunction · 0.70

Calls 3

hasGeeAnalyticsPayloadFunction · 0.90
setLocalCacheFunction · 0.90
isFallbackPayloadFunction · 0.90

Tested by

no test coverage detected