if (FALSE) {
library(rgee)
ee_Initialize(drive = TRUE, gcs = TRUE)
# Region of interest
roi <- ee$Geometry$Polygon(list(
c(-122.275, 37.891),
c(-122.275, 37.868),
c(-122.240, 37.868),
c(-122.240, 37.891)
))
# TIGER: US Census Blocks Dataset
blocks <- ee$FeatureCollection("TIGER/2010/Blocks")
subset <- blocks$filterBounds(roi)
sf_subset <- ee_as_sf(x = subset)
plot(sf_subset)
# Create Random points in Earth Engine
region <- ee$Geometry$Rectangle(-119.224, 34.669, -99.536, 50.064)
ee_help(ee$FeatureCollection$randomPoints)
ee_randomPoints <- ee$FeatureCollection$randomPoints(region, 100)
# Download via GetInfo
sf_randomPoints <- ee_as_sf(ee_randomPoints)
plot(sf_randomPoints)
# Download via drive
sf_randomPoints_drive <- ee_as_sf(
x = ee_randomPoints,
via = 'drive'
)
# Download via GCS
sf_randomPoints_gcs <- ee_as_sf(
x = subset,
via = 'gcs',
container = 'rgee_dev' #GCS bucket name
)
}
Run the code above in your browser using DataLab