To extract the pixel values using point shapefile as feature Collection of time series data (landsat 8) and export it in csv, in python using geemap()

239 views Asked by At

Error occured: "The image must be an instance of ee.Image.", for the following code.

import os
import ee
import geemap
ee.Initialize()
Map = geemap.Map()
Map
india = ee.FeatureCollection("users/GEE_work/INDIA_WITH_KASHMIR")
collection = (
ee.ImageCollection("LANDSAT/LC08/C02/T2_L2")
.filter(ee.Filter.date('2014-01-01', '2022-12-31'))
.select(['SR_B5'])
.filterBounds(india)
)
vis = {
'min': 1,
'max': 65455,
'palette': ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD165', '99B718', '74A901', '66A000', '529400', '3E8601',      '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'        
]
}
gpp = collection.toBands()
Map.addLayer(collection, vis, "L8 nir")
Map.setCentre(79,30,8)
Map
work_dir = os.path.expanduser('C:\\Users\\Hp\\Downloads')
pt = ee.FeatureCollection("users/GEE_work/stations")
out_csv = os.path.join(work_dir, 'L8_B5_NIR_2014_22.csv')
geemap.extract_values_to_points(pt, collection, out_csv)

I am expecting a csv file with pixel values of given point shapefile, of Landsat data from 01-01-2014 to 31-12-2022. It would be very helpful if I get pixel values only for Band 5 (NIR) and Band 6 (SWIR), separately.

0

There are 0 answers