(field: Field)
| 59 | ); |
| 60 | }; |
| 61 | |
| 62 | function getFieldCenter(field: Field) { |
| 63 | const coords = field.coordinates[0]; |
| 64 | const lat = coords.reduce((sum, c) => sum + c[1], 0) / coords.length; |
| 65 | const lng = coords.reduce((sum, c) => sum + c[0], 0) / coords.length; |
| 66 | return { lat, lng }; |
| 67 | } |
| 68 | |
| 69 | const GEE_ANALYTICS_CACHE_KEY = "gee-analytics-cache"; |