From 3c0f0db76375c297e7bcff51ddcdb627c89f907d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ber=C4=99sewicz?= Date: Wed, 28 Oct 2020 09:15:59 +0100 Subject: [PATCH 1/4] added information about the date In this pull request I include information about the date of aerial or satellite photos based in `akt_data` variable available in GUGIK API. This information is crucial if you work with time series data and you would like to know for exactly what period these ortophotomaps are vaild. --- R/orto_request.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/orto_request.R b/R/orto_request.R index 0c526d00..50fbb805 100644 --- a/R/orto_request.R +++ b/R/orto_request.R @@ -23,7 +23,7 @@ orto_request = function(polygon) { stop("no geometries") } - selected_cols = c("godlo", "akt_rok", "piksel", "kolor", "zrDanych", "ukladXY", + selected_cols = c("godlo", "akt_rok", "akt_data", "piksel", "kolor", "zrDanych", "ukladXY", "czy_ark_wypelniony", "url_do_pobrania", "idSerie", "sha1", "nazwa_pliku") selected_cols = paste(selected_cols, collapse = ",") @@ -41,6 +41,7 @@ orto_request = function(polygon) { # initial empty df (columns must be identical as in 'selected_cols') empty_df = data.frame(godlo = character(), akt_rok = integer(), + akt_data = numeric(), piksel = numeric(), kolor = character(), zrDanych = character(), @@ -86,10 +87,11 @@ orto_request = function(polygon) { empty_df = empty_df[!duplicated(empty_df$nazwa_pliku), ] # postprocessing - colnames(empty_df) = c("sheetID", "year", "resolution", "composition", + colnames(empty_df) = c("sheetID", "year", "date", "resolution", "composition", "sensor", "CRS", "isFilled", "URL", "seriesID", "sha1", "filename") empty_df$composition = as.factor(empty_df$composition) + empty_df$date = as.Date(as.POSIXct(empty_df$date / 1000, origin = "1970-01-01", tz = "CET")) empty_df$CRS = as.factor(empty_df$CRS) empty_df$isFilled = ifelse(empty_df$isFilled == "TAK", TRUE, FALSE) empty_df$sensor = factor(empty_df$sensor, From 97f051f742b39bf7995c3fb81610b45a5f58ace6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ber=C4=99sewicz?= Date: Wed, 28 Oct 2020 14:09:55 +0100 Subject: [PATCH 2/4] requested changes to orto_request --- R/orto_request.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/R/orto_request.R b/R/orto_request.R index 50fbb805..77c65237 100644 --- a/R/orto_request.R +++ b/R/orto_request.R @@ -41,7 +41,6 @@ orto_request = function(polygon) { # initial empty df (columns must be identical as in 'selected_cols') empty_df = data.frame(godlo = character(), akt_rok = integer(), - akt_data = numeric(), piksel = numeric(), kolor = character(), zrDanych = character(), @@ -55,7 +54,7 @@ orto_request = function(polygon) { url_do_pobrania = character(), idSerie = integer(), sha1 = character(), - #akt_data = numeric(), + akt_data = numeric(), #idorto = integer(), nazwa_pliku = character() #ESRI_OID = integer() @@ -87,9 +86,9 @@ orto_request = function(polygon) { empty_df = empty_df[!duplicated(empty_df$nazwa_pliku), ] # postprocessing - colnames(empty_df) = c("sheetID", "year", "date", "resolution", "composition", + colnames(empty_df) = c("sheetID", "year", "resolution", "composition", "sensor", "CRS", "isFilled", "URL", "seriesID", - "sha1", "filename") + "sha1", "date", "filename") empty_df$composition = as.factor(empty_df$composition) empty_df$date = as.Date(as.POSIXct(empty_df$date / 1000, origin = "1970-01-01", tz = "CET")) empty_df$CRS = as.factor(empty_df$CRS) From 65d0bcb3dcd0b6e37fbad32fc79aa02718edce1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ber=C4=99sewicz?= Date: Wed, 28 Oct 2020 14:11:05 +0100 Subject: [PATCH 3/4] requested changes in test for orto_request --- tests/testthat/test-orto_request.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-orto_request.R b/tests/testthat/test-orto_request.R index 3b9acc3a..2fea8dee 100644 --- a/tests/testthat/test-orto_request.R +++ b/tests/testthat/test-orto_request.R @@ -17,7 +17,7 @@ if (!"GITHUB_ACTION" %in% names(Sys.getenv())) { }) test_that("check number of columns", { - expect_true(ncol(req_df) == 11) + expect_true(ncol(req_df) == 12) }) } From 5ce0ade45465fa67347d538750f60cd99747774c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ber=C4=99sewicz?= Date: Wed, 28 Oct 2020 14:33:05 +0100 Subject: [PATCH 4/4] changing order of objects in `selected_cols` --- R/orto_request.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/orto_request.R b/R/orto_request.R index 77c65237..f3198fd4 100644 --- a/R/orto_request.R +++ b/R/orto_request.R @@ -23,8 +23,8 @@ orto_request = function(polygon) { stop("no geometries") } - selected_cols = c("godlo", "akt_rok", "akt_data", "piksel", "kolor", "zrDanych", "ukladXY", - "czy_ark_wypelniony", "url_do_pobrania", "idSerie", "sha1", + selected_cols = c("godlo", "akt_rok", "piksel", "kolor", "zrDanych", "ukladXY", + "czy_ark_wypelniony", "url_do_pobrania", "idSerie", "sha1", "akt_data", "nazwa_pliku") selected_cols = paste(selected_cols, collapse = ",")