I have a Landsat Image and an image collection (3 images: static in time but each partially overlapping the Landsat image) with one band and want to add this one band to the Landsat image.
In a traditional GIS/python df I would do an Inner Join based on geometry but I can't figure out how this might be carried out on GEE.
Neither the image or the collection share any bands for a simple join. From what I gather a spatial join is similar to a within buffer so not what I need here. I've also tried the Filter.contains() for the join but this hasn't worked. I tried addBands() despite expecting it not to work and it results in TypeError: 'ImageCollection' object is not callable:
#landsat image and image collection
geometry = ee.FeatureCollection("WWF/HydroSHEDS/v1/Basins/hybas_5").filter(ee.Filter.eq('HYBAS_ID', 7050329490))
landsat= ee.ImageCollection('LANDSAT/LT04/C01/T1_TOA').filterBounds(geometry)
landsat= landsat.first()
imagecollection= ee.ImageCollection("projects/sat-io/open-datasets/GRWL/water_mask_v01_01").filterBounds(geometry)
#example of failure at addBands
combined = landsat.addBands(imagecollection('b1')) #b1 is the only band in the ic
Any help would be appreciated. Edit: I can use a for loop to add each image individually but even with .unmask() these cannot then be combined into a single band because the lack of overlap in the ic results in null values
Not 100% sure this is what you're after, but you can simply mosaic()
the 3 images into one image, and then combine the two datasets into a new ImageCollection.
UPDATE: Use addBands() instead:
// landsat image and image collection
var geometry = ee.FeatureCollection("WWF/HydroSHEDS/v1/Basins/hybas_5").filter(ee.Filter.eq('HYBAS_ID', 7050329490))
var landsat= ee.ImageCollection('LANDSAT/LT04/C01/T1_TOA').filterBounds(geometry)
landsat= landsat.first()
var imagecollection= ee.ImageCollection("projects/sat-io/open-datasets/GRWL/water_mask_v01_01")
.filterBounds(geometry)
.mosaic()
.rename('WaterMask')
print(imagecollection)
// combine both datasets
var combined = landsat.addBands(imagecollection)
print(combined)