...
Code Block | ||
---|---|---|
| ||
# devtools::install_github("wstolte/rwsapi", force = TRUE) require(rwsapi) # retrive metadata metadata <- rwsapi::rws_metadata() # look what's there, e.g. nitrate metadata$content$AquoMetadataLijst$Parameter_Wat_Omschrijving[ grep(x = metadata$content$AquoMetadataLijst$Parameter_Wat_Omschrijving, pattern = "nitraat", ignore.case = T)] locatiecodes <- metadata$content$LocatieLijst$Code grootheidcodes <- metadata$content$AquoMetadataLijst$Grootheid$Code parametercodes <- metadata$content$AquoMetadataLijst$Parameter$Code omschrijvingcodes <- metadata$content$AquoMetadataLijst$Parameter_Wat_Omschrijving myparameter = "NO3" myquantity = "CONCTTE" mylocation <- "SCHAARVODDL" locindex <- which(metadata$content$LocatieLijst$Code == mylocation) x = metadata$content$LocatieLijst$X[locindex] y = metadata$content$LocatieLijst$Y[locindex] # create list for request requestlist <- structure(list( AquoPlusWaarnemingMetadata = structure(list( AquoMetadata = structure(list( Parameter = structure(list( Code = myparameter), .Names = "Code"), Grootheid = structure(list( Code = myquantity), .Names = "Code")), .Names = c("Parameter", "Grootheid"))), .Names = "AquoMetadata"), Locatie = structure(list( X = x, Y = y, Code = mylocation), .Names = c("X","Y", "Code")), Periode = structure(list( Begindatumtijd = "2013-11-27T09:00:00.000+01:00", Einddatumtijd = "2019-10-01T09:01:00.000+01:00"), .Names = c("Begindatumtijd", "Einddatumtijd"))), .Names = c("AquoPlusWaarnemingMetadata", "Locatie", "Periode")) # if you wish to retrieve data from many locations at once: # select locations based on waterbody wslocations <- rwsapi::select_locations_in_waterbody(metadata, "westerschelde", 2000) |
To be continued......