Convert an EE table in a sf object

ee_as_sf(x)

Arguments

x

EE table to be converted into a sf object.

Value

An sf class object, see Details.

Details

For exporting large spatial objects is better creates export pipelines through ee$batch$Export$table$* and rgee::ee_download_* instead of using ee_as_sf. See Client vs Server documentation for details.

Examples

library(rgee) ee_Initialize() roi <- ee$Geometry$Polygon(list( c(-122.27577209472656, 37.891247253777074), c(-122.27577209472656, 37.86875557241152), c(-122.24040985107422, 37.86875557241152), c(-122.24040985107422, 37.891247253777074) )) blocks <- ee$FeatureCollection("TIGER/2010/Blocks") subset <- blocks$filterBounds(roi) sf_subset <- ee_as_sf(subset) cat('Object size in Mb:', as.numeric(object.size(sf_subset)/10^6))
#> Object size in Mb: 0.6172
plot(sf_subset)
# Define an arbitrary region in which to compute random points. region <- ee$Geometry$Rectangle(-119.224, 34.669, -99.536, 50.064) # Create 1000 random points in the region. ee_randomPoints <- ee$FeatureCollection$randomPoints(region) sf_randomPoints <- ee_as_sf(ee_randomPoints) plot(sf_randomPoints)