0

All the bands in the GeoTiff file only contain NA values. Below is my code. I first started with getting an image from ImageCollection and choosing the bands which I want i.e.RGB and export to drive as GeoTiff file.

col1 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').first().select(['B2','B3','B4'])

coords = geo_file['features'][0]['geometry']['coordinates']
aoi = ee.Geometry.Polygon(coords)

task = ee.batch.Export.image.toDrive(**{
    'image': col1,
    'description': 'new_old',
    'folder': 'DS1 Project',
    'scale': 100,
    'fileFormat': 'GeoTIFF',
    'region': coords,
    'crs':'EPSG:4326'
})
task.start()

Then I opened the geotiff image using raster and checking the values:

import rasterio
from rasterio.plot import show
fp = r'/content/new_old.tif'
img = rasterio.open(fp)
print(img.read(1))

array([[nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan], [nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan],

Can you figure out what I am doing wrong?

2
  • And what do you have in 'coordinates'?
    – user30184
    Commented Sep 15, 2022 at 10:10
  • Coordinates are the vertex points of a random rectangular region in terms of lat and long. Commented Sep 18, 2022 at 1:52

1 Answer 1

0

If the polygon coordinates (coords) are not within the footprint of the first image in the image collection (ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').first()), the exported GeoTiff will contain no data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.