rgee
rgee copied to clipboard
Problems with the display of Map with COG
Hi @csaybar , recently I have been using Google Cloud Storage integration with rgee for I have eternal map in Rmkadown, however I have problem with displaying COG format with Map$addLayer, additional I would like to remove the black bakcground.
Here I added my script step by step.
Demo01 [problem: white all image]
img_id <- "https://storage.googleapis.com/rgeedemo01/l9demo1.tif"
viz <- list(
min = 0.07,
max = 0.37,
bands = c("SR_B5","SR_B4","SR_B3")
)
Map$centerObject(img_id)
Map$addLayer(
eeObject = img_id,
visParams = viz,
name = "ica",
titiler_server = "https://api.cogeo.xyz/"
)
Demo 2 [Problem: Black background ]
visParams <- list(
expression = "B5,B4,B3", # Porque cambia el nombre ? no deberia ser SR_*
rescale = "0.07, 0.37",
resampling_method = "cubic")
Map$addLayer(
eeObject = img_id,
visParams = visParams,
name = "Ica",
titiler_server = "https://api.cogeo.xyz/",
titiler_viz_convert = FALSE
)
alternative
visParams <- list(
expression = "B5,B4,B3", # Porque cambia el nombre ? no deberia ser SR_*
rescale = "0.07, 0.37",
nodata = -999 # 0 or -9999 , Nodata = 0 or -9999 (output the same result)
resampling_method = "cubic")
Map$addLayer(
eeObject = img_id,
visParams = visParams,
name = "Ica",
titiler_server = "https://api.cogeo.xyz/",
titiler_viz_convert = FALSE
)

Hi @ambarja i will take a look about it soon :) thank you
Hi @ambarja I was not able to access to your file
Error in private$addCOG(resource = eeObject, visParams = visParams, name = name, :
'/vsicurl/https://storage.googleapis.com/rgeedemo01/l9demo1.tif' not recognized as a supported file format.
# neither with gs://
ee.ee_exception.EEException: Image.loadGeoTIFF: Permission denied: "gs://rgeedemo01/l9demo1.tif"
I was facing the same issue but I apply a sr$updateMask(sr$gt(0)) filter mask to remove the NULL values on my COG image.
Here you gave a reprex. I also prefer to use loadGeoTIFF directly with gs:// method
img_id <- 'gs://public-cog/SR_S2SR_T19HCD_2019-01-01.tif'
sr = ee$Image$loadGeoTIFF(img_id)
sr = sr$updateMask(sr$gt(0))
viz <- list(
min = 0,
max = 10000,
bands = c("B5","B4","B3")
)
Map$centerObject(sr)
Map$addLayer(
eeObject = sr,
visParams = viz,
name = "rgb",
titiler_server = "https://api.cogeo.xyz/"
)
