cran / openmeteo

:exclamation: This is a read-only mirror of the CRAN R package repository. openmeteo — Retrieve Weather Data from the Open-Meteo API
0 stars 1 forks source link

weather_history does not accept coordinate location #1

Closed iambodo closed 2 months ago

iambodo commented 3 months ago

Nice package and service!

However I notice that the weather_historyfunction throws errors when passing direct coordinates as location,

Documentation states:

The location for which data will be retrieved. Supplied as either a c(latitude,longitude) WGS84 coordinate pair or a place name string (with co-ordinates obtained via geocode()).

When I try to pass coordinates as a string or sf obect, I get errors, as it only accepts geocodable placenames. tHis sems to be the expectation in the function.

This seems to be the basic behavior of the query function. So I will need to find a workaround...

Reprex:

df_test<-data.frame(
  location="Imeko Afon",
  x=2.86779009861854,
  y=7.59015267502207
)

df_coord <- st_as_sf(df_test, coords = c(2:3))

test<-"c(2.86779009861854,7.59015267502207)"

weather_history(
    location=df_test$location[1],
    start="2020-01-01",
    end="2021-01-01",
    daily = "precipitation_sum"
  )
**Error in .coords_generic(location) : 
  location not provided as co-ordinate pair or string**

weather_history(
    location=test,
    start="2020-01-01",
    end="2021-01-01",
    daily = "precipitation_sum"
  )
  **Error in geocode(x, silent = FALSE) : No matches found**
gaborcsardi commented 3 months ago

Hi, this is a read only mirror of CRAN, please see the package authors in the DESCRIPTION file. Look for Maintainer, BugReports and URL. Thanks!