-
Notifications
You must be signed in to change notification settings - Fork 2
Examples
Davide Bassi edited this page Jun 11, 2023
·
5 revisions
import com.openmeteo.api.Forecast
import com.openmeteo.api.common.query.City
import com.openmeteo.api.common.time.Timezone
val query = Forecast.Query(
latitude = City.Amsterdam.latitude,
longitude = City.Amsterdam.longitude,
daily = Forecast.Daily { listOf(
weathercode, sunrise, sunset, temperature2mMax, temperature2mMin
) },
currentWeather = true,
)
Forecast(query).getOrThrow().run {
println("Coordinates: [ $latitude, $longitude ]")
currentWeather?.run {
println("Timestamp: $time")
println("Temperature: $temperature°C")
println("Message: $weatherCode")
println("Daylight: $isDay")
}
}