Created
September 14, 2021 13:07
-
-
Save csaybar/c1e33355ee9cb9eb212517dd9992a215 to your computer and use it in GitHub Desktop.
LANDSAT VS SENTINEL VS PLANET
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) | |
library(rgeeExtra) | |
# Roy account | |
ee_Initialize("roy1") | |
# Load Planet, Sentinel-2, and Landsat-8 | |
# ee_utils_dataset_display(planet) | |
planet <- ee$ImageCollection('projects/planet-nicfi/assets/basemaps/americas') | |
s2 <- ee$ImageCollection$Dataset$COPERNICUS_S2_SR | |
l8 <- ee$ImageCollection$Dataset$LANDSAT_LC08_C02_T1_L2 | |
# Center Map | |
Map$setCenter(-77.03379, -12.06716, 16) | |
# Define img boundaries | |
geom <- ee$Geometry$Point(-77.03379, -12.06716) | |
# get a image from a city | |
planet_img <- planet[[20]] | |
date <- ee_get_date_img(planet_img)[["time_start"]] %>% as.Date() | |
s2_img <- s2 %>% | |
ee$ImageCollection$filterBounds(geom$buffer(10000)) %>% | |
ee$ImageCollection$filterDate(as.character(date - 100), as.character(date + 100)) %>% | |
ee$ImageCollection$filter(ee$Filter$lt('CLOUDY_PIXEL_PERCENTAGE', 1)) %>% | |
'[['(1) | |
l8_img <- l8 %>% | |
ee$ImageCollection$filterBounds(geom$buffer(10000)) %>% | |
ee$ImageCollection$filterDate(as.character(date - 100), as.character(date + 100)) %>% | |
ee$ImageCollection$filter(ee$Filter$lt('CLOUD_COVER', 5)) %>% | |
'[['(1) | |
Map$setCenter(-77.02931, -12.05557, 13) | |
m1 <- Map$addLayer(planet_img, list(gain = 0.15, bands = list("R", "G", "B"))) | |
m2 <- Map$addLayer(s2_img, list(max = 6000, bands = list("B4", "B3", "B2"))) | |
m3 <- Map$addLayer(l8_img, list(max = 20000, bands = list("SR_B4", "SR_B3", "SR_B2"))) | |
m1 | m2 | |
m1 | m3 | |
names(img22) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment