Closed ilarischeinin closed 6 years ago
Thanks for the report @ilarischeinin ! The error you encountered is due to the recent switch from rgdal
to sf
. There's a lot to be fixed in the tutorial and I was just working my way through it over the weekend. Unfortunately getting rasters over the API proved to more tricky than I thought. Furthermore, much of the background explanation in the tutorial has become obsolete since dropping GDAL CLI tools (i.e. ogr2ogr
) so I need to check all the text as well. In any case, the fixed tutorial is not in master
yet.
For now you should be able to run the piece of code above (but not the whole tutorial) by doing the following:
library(fmi)
apiKey <- "" # with a valid key
request <- FMIWFSRequest$new(apiKey = apiKey)
request$setParameters(request = "getFeature",
storedquery_id = "fmi::observations::weather::daily::timevaluepair",
starttime = "2014-01-01T00:00:00Z",
endtime = "2014-01-01T00:00:00Z",
bbox = "19.09,59.3,31.59,70.13",
parameters = "rrday,snow,tday,tmin,tmax")
client <- FMIWFSClient$new(request = request)
layers <- client$listLayers()
response <- client$getLayer(layer = layers$name)
# or alternatively:
# response <- client$getLayer(layer = layers[[1]])
Apologies for the extra hassle you had to go through in tracing the error, I should've communicated the situation better.
Then there's also this #30 , feel free to chime in.
Ah, great, thank you!
Actually, I wasn't really going through the tutorial, but simply noticed that some of my own old code didn't work anymore. I used the example from the tutorial just to get a reprex that's as familiar as possible. I had recently updated the OS and all, so I thought the problem was at my end. I did check the NEWS.md though, to see if it mentioned any breaking changes. Perhaps it would be worth it to mention something there, as there might be others besides me who suddenly find their code not working anymore.
Very good point. The thing is, that the breaking change is at rwfs
's end. Also I'm pretty sure that this wasn't a breaking change initially as the switch is already more than a year old and at the time the old call signature did work. It could be that changes sf
caused the issue more recently.
In any case, all this explaining makes a little difference from user's point of view. I'll add a note in rwfs
and link it back here. Yet another reason not to have the separation between the two packages...
I'm not sure if this is really about
fmi
(or ratherrwfs
), but I get the following error when I try to run the code from the tutorial:The two files from the temp directory are attached (I added a ".txt" suffix so that GitHub would accept them).
Below is my
sessionInfo()
. Bothfmi
andrwfs
are the current GitHub versions (SHAs aa9ec3b1 and 6c341a0a).This is with
gdal 1.11.5_3
andgeos 3.6.2
installed via Homebrew andrgdal
andrgeos
compiled from source. At first I had the same error message with binary versions installed from CRAN (without the Homebrew packages). But since with that setup the output fromlibrary(rgdal)
includedGDAL binary built with GEOS: FALSE
and I wasn't sure if that was required, I installed the Homebrew versions and complied the R packages from source, so that it's nowTRUE
:And finally, here's
ogrDrivers()$name
:file59b658cff123 file59b658cff123.gfs