library(rgee)
# Initialize the Earth Engine module.
ee_Initialize()
# Print metadata for a MODIS dataset.
print(ee$ImageCollection("MODIS/061/MOD11A2")$getInfo())
Attach your Python (reticulate) configuration:
library(reticulate)
py_config()
Description
I want to extract the temperature values by pixel in MODIS data using rgee package. I have the polygon about the project in the featureCollection type.
What I Did
shp = ee$FeatureCollection('users/zeycasozen/R_LST');
print(shp);
ckale_img = ee$ImageCollection("MODIS/061/MOD11A2")$filter(ee$Filter$date('2003-01-01', '2003-02-01'));
library(rgee)
library(tidyverse)
ee_Initialize()
# Getting temperature band from Landsat 8
start <- ee$Date$fromYMD(2003,1,1) # Start date for filtering
end <- ee$Date$fromYMD(2003,2,1) # End date for filtering
imgC <- ee$ImageCollection("MODIS/061/MOD11A2")$filterDate(start,end)
# ee$ImageCollection$map(qFn)
mod <- imgC$select("LST_Day_1km") %>% # Selecting temperature parameters
ee$ImageCollection$median() %>% # Getting image by taking median
ee$Image$clip(shp) # Clipping image to city boundaries
# Calculating mean of cities - tempMean feature collection does not contain a mean property
data_city <- ee_extract(
x = mod,
y = shp,
sf = TRUE,
fun = ee$Reducer$median(),
scale = 1000
)
**Number of features: 1 (result = created single values )
OR
getRegion <- ckale_img$getRegion(geometry = shp,
scale = 1000)
print(getRegion$getInfo())
...
[[1000]]
[[1000]][[1]]
[1] "2003_01_17"
[[1000]][[2]]
[1] 26.50479
[[1000]][[3]]
[1] 39.97952
[[1000]][[4]]
[1] -1
[[1000]][[5]]
[1] 14033
[[1000]][[6]]
[1] 0
[[1000]][[7]]
[1] 113
[[1000]][[8]]
[1] 88
[[1000]][[9]]
[1] 13829
[[1000]][[10]]
NULL
[[1000]][[11]]
[1] 223
[[1000]][[12]]
[1] 87
[[1000]][[13]]
[1] 248
[[1000]][[14]]
[1] 249
[[1000]][[15]]
[1] 65
[[1000]][[16]]
[1] 81
But I want extract values from each pixel in MODIS data. How can I do?
Thank you.
At submit an issue, please attached the following information of your
rgee
session:[ ] You have the Python API installed (from terminal):
[ ] You can find the credentials file on your system:
[ ] You can run a simple EE command from R:
Attach your Python (reticulate) configuration:
Description
I want to extract the temperature values by pixel in MODIS data using rgee package. I have the polygon about the project in the featureCollection type.
What I Did
But I want extract values from each pixel in MODIS data. How can I do? Thank you.