4
4
# ' @param properties A vector of requested columns
5
5
# ' @param service character, can be any existing collection such
6
6
# ' as "daily", "monitoring-locations", "time-series-metadata"
7
+ # ' @param skipGeometry A logical for whether to return geometry
8
+ # ' @param convertType A logical for whether to convert value to numeric
7
9
# '
8
10
# ' @return data.frame
9
11
# ' @noRd
18
20
# ' service = "daily")
19
21
# '
20
22
deal_with_empty <- function (return_list , properties , service ,
21
- skipGeometry = TRUE ){
23
+ skipGeometry = TRUE ,
24
+ convertType = TRUE ){
25
+
22
26
if (nrow(return_list ) == 0 ){
23
27
24
28
if (all(is.na(properties ))){
@@ -38,9 +42,17 @@ deal_with_empty <- function(return_list, properties, service,
38
42
}
39
43
}
40
44
41
- if (service == " daily" ){
45
+ if (convertType && service == " daily" ){
42
46
return_list $ time <- as.Date(as.character())
43
47
}
48
+
49
+ if (convertType && " value" %in% names(return_list )){
50
+ return_list $ value <- as.numeric()
51
+ }
52
+
53
+ if (convertType && " contributing_drainage_area" %in% names(return_list )){
54
+ return_list $ contributing_drainage_area <- as.numeric()
55
+ }
44
56
45
57
return_list <- data.frame (return_list )
46
58
return_list $ geometry <- NULL
@@ -301,7 +313,7 @@ get_ogc_data <- function(args,
301
313
}
302
314
303
315
return_list <- deal_with_empty(return_list , properties , service ,
304
- skipGeometry )
316
+ skipGeometry , convertType )
305
317
306
318
if (convertType ) return_list <- cleanup_cols(return_list , service = service )
307
319
0 commit comments