Created
August 8, 2020 08:30
-
-
Save csaybar/e1d0c587cdf940ac490cca214d8a58a8 to your computer and use it in GitHub Desktop.
ee_help addin demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgee) | |
help() | |
# Install rgee v.1.0.4 | |
# devtools::install_github("r-spatial/rgee") | |
ee_Initialize() | |
s2_img_array <- ee$ImageCollection("COPERNICUS/S2") %>% | |
ee$ImageCollection$filterBounds(ee_random_point)%>% # Filter by space | |
ee$ImageCollection$filterDate("2016-01-01", "2016-12-31") %>% # Filter by time | |
ee$ImageCollection$mosaic() %>% # Create a ee$Image | |
ee$Image$addBands(ee$Image$pixelLonLat()) %>% # Add coordinate | |
ee$Image$select(band_names) %>% # Select only bands specified in band_names | |
ee$Image$reproject(crs = "EPSG:4326", scale = 10) %>% # Create a data-cube | |
ee$Image$neighborhoodToArray( | |
kernel = ee$Kernel$rectangle(128, 128, "pixels") | |
) %>% # from 1D to 2D (select pixel neighborhood) | |
ee$Image$sampleRegions(ee$FeatureCollection(ee_random_point)) %>% | |
ee$FeatureCollection$getInfo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment