Skip to content

Commit 4c95118

Browse files
committed
cran changes
1 parent e0688a4 commit 4c95118

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+461
-886
lines changed

NAMESPACE

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ export(ee_manage_set_properties)
5454
export(ee_manage_task)
5555
export(ee_monitoring)
5656
export(ee_print)
57-
export(ee_search_dataset)
58-
export(ee_search_display)
59-
export(ee_search_enddate)
60-
export(ee_search_provider)
61-
export(ee_search_provider_list)
62-
export(ee_search_startdate)
63-
export(ee_search_tags)
64-
export(ee_search_tagstitle)
65-
export(ee_search_title)
66-
export(ee_search_title_list)
67-
export(ee_search_type)
6857
export(ee_table_to_asset)
6958
export(ee_table_to_drive)
7059
export(ee_table_to_gcs)

R/Deprecated.R

Lines changed: 0 additions & 301 deletions
Original file line numberDiff line numberDiff line change
@@ -1,301 +0,0 @@
1-
#' Interface to search into the Earth Engine Data Catalog
2-
#'
3-
#' R functions for searching in Earth Engine's public data archive.
4-
#'
5-
#' @param quiet logical. Suppress info message
6-
#' @param ee_search_dataset data.frame generated by rgee::ee_search_Datasets()
7-
#' or a character which represents the EE dataset ID.
8-
#' @param stardate Character. Start date of dataset availability.
9-
#' @param enddate Character. End date of dataset availability.
10-
#' @param provider Character. Name of the dataset's provider. See
11-
#' ee_search_provider_list()
12-
#' @param type Character. "Image", "ImageCollection" or a "table".
13-
#' @param ... Character vector. tags
14-
#' @param logical_operator Character. Available just for rgee::ee_search_tags
15-
#' and rgee::ee_search_title. 'AND' represents inclusiveness between tags in
16-
#' searching and 'OR' exclusiveness.
17-
#' @param upgrade Logical. If the dataset needs to be upgraded.
18-
#' @param maxdisplay Numeric. Maximum number of tabs to display in their browser
19-
#' @param path_dataset Path of the dataset. By default it will loaded
20-
#' automatically.
21-
#' @name ee_search-tools
22-
#' @return A data.frame where rows represents public data archive.
23-
#' @examples
24-
#' \dontrun{
25-
#' library(rgee)
26-
#' ee_Initialize()
27-
#'
28-
#' # ee_search_provider_list()
29-
#' # ee_search_title_list()
30-
#' myquery <- ee_search_dataset() %>%
31-
#' ee_search_type("Image") %>%
32-
#' ee_search_provider("WWF") %>%
33-
#' ee_search_tags("srtm", "flow", "direction", "dem") %>%
34-
#' ee_search_title("15", "Flow", logical_operator = "AND") %>%
35-
#' ee_search_display()
36-
#' }
37-
#' @export
38-
ee_search_dataset <- function(quiet = FALSE,
39-
upgrade = FALSE,
40-
path_dataset = NULL) {
41-
message_deprecated <- c(
42-
"\"ee_search_dataset\" will not be available for rgee version 1.0.8 ."
43-
)
44-
.Deprecated("ee_search_dataset", msg = message_deprecated)
45-
46-
oauth_func_path <- system.file("python/ee_utils.py", package = "rgee")
47-
utils_py <- ee_source_python(oauth_func_path)
48-
ee_path <- ee_utils_py_to_r(utils_py$ee_path())
49-
ee_search_dataset_file <- sprintf(
50-
"%s/ee_search_dataset.csv",
51-
ee_path
52-
)
53-
if (file.exists(ee_search_dataset_file) & !upgrade) {
54-
ee_search_dataset <- read.csv(ee_search_dataset_file,
55-
stringsAsFactors = FALSE)
56-
} else {
57-
if (is.null(path_dataset)) {
58-
user_samapriya <- "https://raw.githubusercontent.com/csaybar/"
59-
ee_template <- "%sEarth-Engine-Datasets-List/master/%s"
60-
ee_search_dataset_uri <- sprintf(ee_template, user_samapriya,
61-
find_eedataset())
62-
} else {
63-
ee_search_dataset_uri <- path_dataset
64-
}
65-
ee_search_dataset <- read.csv(ee_search_dataset_uri,
66-
stringsAsFactors = FALSE)
67-
if (!quiet) {
68-
cat("Downloading(Upgrading) the Earth Engine catalog ... please wait\n")
69-
}
70-
write.csv(
71-
x = ee_search_dataset,
72-
file = ee_search_dataset_file,
73-
row.names = FALSE
74-
)
75-
}
76-
return(ee_search_dataset)
77-
}
78-
79-
#' @name ee_search-tools
80-
#' @export
81-
ee_search_startdate <- function(ee_search_dataset, stardate) {
82-
message_deprecated <- c(
83-
"\"ee_search_startdate\" will not be available for rgee version 1.0.8 ."
84-
)
85-
.Deprecated("ee_search_startdate", msg = message_deprecated)
86-
87-
m <- gregexpr("[\\w']+", ee_search_dataset$start_date, perl = TRUE)
88-
ee_start_date <- ee_search_dataset$start_date %>%
89-
regmatches(m) %>%
90-
lapply(fix_date)
91-
m <- do.call(c, m)
92-
stardate <- as.Date(stardate)
93-
ee_search_dataset_q <- ee_search_dataset[which(ee_start_date > stardate), ]
94-
rownames(ee_search_dataset_q) <- NULL
95-
return(ee_search_dataset_q)
96-
}
97-
98-
#' @name ee_search-tools
99-
#' @export
100-
ee_search_enddate <- function(ee_search_dataset, enddate = Sys.Date()) {
101-
message_deprecated <- c(
102-
"\"ee_search_enddate\" will not be available for rgee version 1.0.8 ."
103-
)
104-
.Deprecated("ee_search_enddate", msg = message_deprecated)
105-
m <- gregexpr("[\\w']+", ee_search_dataset$end_date, perl = TRUE)
106-
ee_end_date <- ee_search_dataset$end_date %>%
107-
regmatches(m) %>%
108-
lapply(fix_date)
109-
m <- do.call(c, m)
110-
enddate <- as.Date(enddate)
111-
ee_search_dataset_q <- ee_search_dataset[which(ee_end_date < enddate), ]
112-
rownames(ee_search_dataset_q) <- NULL
113-
return(ee_search_dataset_q)
114-
}
115-
116-
#' @name ee_search-tools
117-
#' @export
118-
ee_search_type <- function(ee_search_dataset, type) {
119-
message_deprecated <- c(
120-
"\"ee_search_type\" will not be available for rgee version 1.0.8 ."
121-
)
122-
.Deprecated("ee_search_type", msg = message_deprecated)
123-
ee_search_dataset_type <- tolower(ee_search_dataset$type)
124-
type <- tolower(type)
125-
if (type %in% unique(ee_search_dataset_type)) {
126-
ee_search_dataset_q <- ee_search_dataset[ee_search_dataset_type %in% type, ]
127-
rownames(ee_search_dataset_q) <- NULL
128-
return(ee_search_dataset_q)
129-
} else {
130-
stop("type argument is not valid")
131-
}
132-
}
133-
134-
#' @name ee_search-tools
135-
#' @export
136-
ee_search_provider <- function(ee_search_dataset, provider) {
137-
message_deprecated <- c(
138-
"\"ee_search_provider\" will not be available for rgee version 1.0.8 ."
139-
)
140-
.Deprecated("ee_search_provider", msg = message_deprecated)
141-
if (provider %in% unique(ee_search_dataset$provider)) {
142-
condition <- ee_search_dataset$provider %in% provider
143-
ee_search_dataset_q <- ee_search_dataset[condition,]
144-
rownames(ee_search_dataset_q) <- NULL
145-
return(ee_search_dataset_q)
146-
} else {
147-
stop("provider argument is not valid")
148-
}
149-
}
150-
151-
#' @name ee_search-tools
152-
#' @export
153-
ee_search_provider_list <- function(ee_search_dataset) {
154-
message_deprecated <- c(
155-
"\"ee_search_provider_list\" will not be available for rgee version 1.0.8 ."
156-
)
157-
.Deprecated("ee_search_provider_list", msg = message_deprecated)
158-
return(unique(ee_search_dataset$provider))
159-
}
160-
161-
#' @name ee_search-tools
162-
#' @export
163-
ee_search_tags <- function(ee_search_dataset, ..., logical_operator = "OR") {
164-
message_deprecated <- c(
165-
"\"ee_search_tags\" will not be available for rgee version 1.0.8 ."
166-
)
167-
.Deprecated("ee_search_tags", msg = message_deprecated)
168-
tags <- tolower(c(...))
169-
ee_tags <- tolower(ee_search_dataset$tags)
170-
if (logical_operator == "OR") {
171-
cond <- mapply(function(x) grepl(x, ee_tags), tags) %>% apply(1, any)
172-
} else if (logical_operator == "AND") {
173-
cond <- mapply(function(x) grepl(x, ee_tags), tags) %>% apply(1, all)
174-
} else {
175-
stop("logical_operator argument is not valid")
176-
}
177-
ee_search_dataset_q <- ee_search_dataset[cond, ]
178-
rownames(ee_search_dataset_q) <- NULL
179-
return(ee_search_dataset_q)
180-
}
181-
182-
#' @name ee_search-tools
183-
#' @export
184-
ee_search_title <- function(ee_search_dataset, ..., logical_operator = "OR") {
185-
message_deprecated <- c(
186-
"\"ee_search_title\" will not be available for rgee version 1.0.8."
187-
)
188-
.Deprecated("ee_search_title", msg = message_deprecated)
189-
tags <- tolower(c(...))
190-
ee_title <- tolower(ee_search_dataset$title)
191-
if (logical_operator == "OR") {
192-
cond <- mapply(function(x) grepl(x, ee_title), tags) %>% apply(1, any)
193-
} else if (logical_operator == "AND") {
194-
cond <- mapply(function(x) grepl(x, ee_title), tags) %>% apply(1, all)
195-
} else {
196-
stop("logical_operator argument is not valid")
197-
}
198-
ee_search_dataset_q <- ee_search_dataset[cond, ]
199-
rownames(ee_search_dataset_q) <- NULL
200-
return(ee_search_dataset_q)
201-
}
202-
203-
204-
#' @name ee_search-tools
205-
#' @export
206-
ee_search_tagstitle <- function(ee_search_dataset, ...,
207-
logical_operator = "OR") {
208-
message_deprecated <- c(
209-
"\"ee_search_tagstitle\" will not be available for rgee version 1.0.8."
210-
)
211-
.Deprecated("ee_search_tagstitle", msg = message_deprecated)
212-
213-
tags <- tolower(c(...))
214-
ee_title <- tolower(ee_search_dataset$title)
215-
ee_tags <- tolower(ee_search_dataset$tags)
216-
if (logical_operator == "OR") {
217-
cond_1 <- mapply(function(x) grepl(x, ee_title), tags) %>% apply(1, any)
218-
cond_2 <- mapply(function(x) grepl(x, ee_tags), tags) %>% apply(1, any)
219-
cond_3 <- mapply(any, cond_1, cond_2)
220-
} else if (logical_operator == "AND") {
221-
cond_1 <- mapply(function(x) grepl(x, ee_title), tags) %>% apply(1, all)
222-
cond_2 <- mapply(function(x) grepl(x, ee_tags), tags) %>% apply(1, all)
223-
cond_3 <- mapply(any, cond_1, cond_2)
224-
} else {
225-
stop("logical_operator argument is not valid")
226-
}
227-
ee_search_dataset_q <- ee_search_dataset[cond_3, ]
228-
rownames(ee_search_dataset_q) <- NULL
229-
return(ee_search_dataset_q)
230-
}
231-
232-
#' @name ee_search-tools
233-
#' @export
234-
ee_search_title_list <- function(ee_search_dataset) {
235-
message_deprecated <- c(
236-
"\"ee_search_title_list\" will not be available for rgee version 1.0.8."
237-
)
238-
.Deprecated("ee_search_title_list", msg = message_deprecated)
239-
return(unique(ee_search_dataset$provider))
240-
}
241-
242-
#' Change the date format
243-
#' @noRd
244-
fix_date <- function(x) {
245-
month <- x[1]
246-
day <- x[2]
247-
year <- x[3]
248-
if (nchar(year) == 2 & as.integer(year) > 50) {
249-
year <- 1900 + as.integer(year)
250-
} else if (nchar(year) == 2 & as.integer(year) <= 50) {
251-
year <- 2000 + as.integer(year)
252-
} else {
253-
year <- as.integer(year)
254-
}
255-
final_date <- as.Date(sprintf("%s-%s-%s", year, month, day))
256-
return(final_date)
257-
}
258-
259-
#' @name ee_search-tools
260-
#' @export
261-
ee_search_display <- function(ee_search_dataset, maxdisplay = 10) {
262-
message_deprecated <- c(
263-
"\"ee_search_title_list\" will not be available for rgee version 1.0.8.",
264-
" Use ee_utils_search_display instead."
265-
)
266-
.Deprecated("ee_search_title_list", msg = message_deprecated)
267-
268-
if (is.character(ee_search_dataset)) {
269-
tag_name <- gsub("\\/", "_", ee_search_dataset)
270-
} else {
271-
tag_name <- gsub("\\/", "_", ee_search_dataset$id)
272-
}
273-
db_catalog <- "https://developers.google.com/earth-engine/datasets/catalog/"
274-
catalog_uri <- paste0(db_catalog, tag_name) %>%
275-
"["(1:maxdisplay) %>%
276-
na.omit() %>%
277-
as.character()
278-
for (uri in catalog_uri) {
279-
browseURL(uri)
280-
}
281-
invisible(TRUE)
282-
}
283-
284-
#' Find the EE Dataset List on GitHub
285-
#' @noRd
286-
find_eedataset <- function() {
287-
message_deprecated <- c(
288-
"\"ee_search_title_list\" will not be available for rgee version 1.0.8."
289-
)
290-
.Deprecated("ee_search_title_list", msg = message_deprecated)
291-
292-
if (!requireNamespace("httr", quietly = TRUE)) {
293-
stop("package httr required, please install it first")
294-
}
295-
git_repo <- "https://api.github.com/repos/csaybar/Earth-Engine-Datasets-List/"
296-
req <- httr::GET(sprintf("%s/git/trees/master?recursive=1", git_repo))
297-
httr::stop_for_status(req)
298-
filelist <- lapply(httr::content(req)$tree, "[", "path")
299-
filelist <- unlist(filelist, use.names = FALSE)
300-
filelist[grepl("eed", filelist)]
301-
}

R/Map.R

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,7 @@
147147
#' name = "SF"
148148
#' )
149149
#'
150-
#' # Case 5: mapview + EarthEnginemap
151-
#' # library(mapview)
152-
#' # library(sf)
153-
#' # nc <- st_read(system.file("shp/arequipa.shp", package="rgee"))
154-
#' # mapview(nc, m2)
155-
#'
156-
#' # Case 6: mapedit
157-
#' # library(mapedit)
158-
#' # my_geometry <- m4 %>% editMap()
159-
#'
160-
#' # Case 7: ImageCollection
150+
#' # Case 5: ImageCollection
161151
#' nc <- st_read(system.file("shape/nc.shp", package = "sf")) %>%
162152
#' st_transform(4326) %>%
163153
#' sf_as_ee()
@@ -170,7 +160,7 @@
170160
#' m5 <- Map$addLayers(ee_s2, legend = TRUE)
171161
#' m5
172162
#'
173-
#' # Case 8: Map comparison
163+
#' # Case 6: Map comparison
174164
#' image <- ee$Image("LANDSAT/LC08/C01/T1/LC08_044034_20140318")
175165
#' Map$centerObject(image)
176166
#' m_ndvi <- Map$addLayer(
@@ -182,7 +172,7 @@
182172
#' m6 <- m4 | m_ndvi
183173
#' m6
184174
#'
185-
#' # Case 9: digging up the metadata
175+
#' # Case 7: digging up the metadata
186176
#' m6$rgee$tokens
187177
#' m5$rgee$tokens
188178
#' }

0 commit comments

Comments
 (0)