Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions xee/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,14 @@ def get_info(self) -> Dict[str, Any]:
rpcs.append(('projection', self.projection))

if isinstance(self.geometry, ee.Geometry):
rpcs.append(('bounds', self.geometry.bounds()))
rpcs.append(('bounds', self.geometry.bounds(1, proj=self.projection)))
else:
rpcs.append(('bounds', self.image_collection.first().geometry().bounds()))
rpcs.append((
'bounds',
self.image_collection.first()
.geometry()
.bounds(1, proj=self.projection),
))

# TODO(#29, #30): This RPC call takes the longest time to compute. This
# requires a full scan of the images in the collection, which happens on the
Expand Down
26 changes: 26 additions & 0 deletions xee/ext_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,32 @@ def __getitem__(self, params):

self.assertEqual(getter.count, 3)

def test_geometry_bounds_with_and_without_projection(self):
image = (
ee.ImageCollection('LANDSAT/LC08/C01/T1')
.filterDate('2017-01-01', '2017-01-03')
.first()
)
point = ee.Geometry.Point(-40.2414893624401, 105.48790177216375)
distance = 311.5
scale = 5000
projection = ee.Projection('EPSG:4326', [1, 0, 0, 0, -1, 0]).atScale(scale)
image = image.reproject(projection)

geometry = point.buffer(distance, proj=projection).bounds(proj=projection)

data_store = xee.EarthEngineStore(
ee.ImageCollection(image),
projection=image.projection(),
geometry=geometry,
)
data_store_bounds = data_store.get_info['bounds']

self.assertNotEqual(geometry.bounds().getInfo(), data_store_bounds)
self.assertEqual(
geometry.bounds(1, proj=projection).getInfo(), data_store_bounds
)


class EEBackendEntrypointTest(absltest.TestCase):

Expand Down