Description Usage Arguments Examples
Create a zip file from a sf object
1 | ee_create_shp_zip(x, filename, SHP_EXTENSIONS = c("dbf", "prj", "shp", "shx"))
|
x |
sf object |
filename |
data source name |
SHP_EXTENSIONS |
file extension of the files to save into the zip file. By default: "dbf", "prj", "shp", "shx". |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ## Not run:
library(rgee)
library(sf)
ee_Initialize(gcs = TRUE)
# Create sf object
nc <- st_read(system.file("shape/nc.shp", package="sf"))
assetId <- sprintf("%s/%s",ee_get_assethome(),'sf_nc')
# Method 1
# 1. Pass the sf to a zip file
zipfile <- ee_create_shp_zip(nc)
# 2. From local to gcs
gs_uri <- local_to_gcs(x = zipfile, bucket = 'rgee_dev')
# 3. Pass the sf to a zip file
gcs_to_ee_table(
gs_uri = gs_uri,
assetId = assetId
)
# OPTIONAL: Monitoring progress
ee_monitoring()
# OPTIONAL: Display results
ee_sf_01 <- ee$FeatureCollection(assetId)
Map$centerObject(ee_sf_01)
Map$addLayer(ee_sf_01)
# Method 2
ee_sf_02 <- sf_as_ee(x = nc,
assetId = assetId,
bucket = "rgee_dev")
Map$centerObject(ee_sf_02)
Map$addLayer(ee_sf_02)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.