0

I have a simple problem of not being able to select a single Landsat image using filterBounds within Jupyter environment. It used to work just fine in Earth Engine's online interface. I don't know why it should fail now.

import ee
ee.Initialize()

lat = 45
lon = -100
Radius = 1000

roi = ee.Geometry.Point([lat, lon]).buffer(Radius)
point = ee.Geometry.Point (lat, lon)
start = ee.Date('2017-01-01')
finish = ee.Date('2018-12-01')
L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1")

Time_Set = ee.ImageCollection(
  L8.filterDate(start, finish)
    .filter(ee.Filter.lt('CLOUD_COVER', 2))
)
print('Number of images in Time Set: ', Time_Set.size().getInfo())

Space_Set = ee.ImageCollection(
    L8.filterBounds(ee.Geometry.Point(lat, lon))
)

print('Number of images in Space Set: ', Space_Set.size().getInfo())

Printed results:

Number of images in Time Set:  64343
Number of images in Space Set:  0
  • 1
    Please include relevant code inside code tags within this question. Screenshots of code make it hard to reproduce the problem for people trying to help you. – Kersten Nov 8 '18 at 21:29
2

For the ee.Geometry.Point() constructor, the dimension ordering of the coord parameter is longitude,latitude (or x,y), rather than latitude,longitude. Once you reverse your parameters, you should see some resulting images in the filtered collection.

Space_Set = ee.ImageCollection(
    L8.filterBounds(ee.Geometry.Point(lon, lat))
)
print('Number of images in Space Set: ', Space_Set.size().getInfo())

results in:

Number of images in Space Set:  295
  • Thanks, Tyler. This works. I suspected this might be the case so I tried some lat = lon points for trial such as (0,0) and (2,2) but that yielded 0 images as well. Now I wonder why might that have happened. – Anamika Nov 9 '18 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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