Skip to content
Snippets Groups Projects

feat: Septoria humidity with point selection, first version

Compare and
6 files
+ 277
52
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 25
0
@@ -421,3 +421,28 @@ function getLocalizedCropCategoryName(cropCategory)
// Then we give up
return gettext("Unnamed");
}
async function getLocationInformation(latitude, longitude) {
let location = "Unknown"
let timezone = "Europe/Oslo"
try {
const response = await fetch(`https://api.geoapify.com/v1/geocode/reverse?lat=${latitude}&lon=${longitude}&format=json&apiKey=${settings.geoapifyApiKey}`);
const respJson = await response.json()
if(respJson.results && respJson.results.length > 0) {
location = respJson.results[0].city ? respJson.results[0].city : respJson.results[0].formatted;
timezone = respJson.results[0].timezone.name;
} else {
console.error("Unable to get location information for for lat=" + latitude + " lon=" + longitude)
}
} catch (error) {
console.error("Error fetching location information", error)
}
return {
latitude: latitude,
longitude: longitude,
location: location,
timezone: timezone
}
}
Loading