Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to make large requests to the ecoengine

Here are two ways to combine data from large requests to ecoengine

Method 1 (trivial)

# A trivial way to combine results from a paginated request
pinus <- ee_observations(scientific_name = "Pinus")
pinus2 <- ee_observations(scientific_name = "Pinus", page = 2)
all_pinus_data <- ee_cbind(list(pinus, pinus2))

Method 2 (more efficient)

pinus <- ee_observations(scientific_name = "Pinus")
total_pages <- ee_pages(pinus)
grouped_pages <- split(1:total_pages, ceiling(1:total_pages/50))
# This splits the query into 39 groups, 50 pages per groups
# You can control this by changing 50 to a larger number.

# This call below will retrieve 1250 (50 pages, 25 results/page) results.
all_data <- llply(grouped_pages[1], function(x) {
	ee_observations(scientific_name = "Pinus", page = x, progress = FALSE, quiet = TRUE)
}, .progress = "text")

all_pinus_data <- ee_cbind(all_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment