geetools.JoinAccessor.byProperty#

static geetools.JoinAccessor.byProperty(primary, secondary, field, outer=False)#

Join 2 collections by a given property field.

It assumes ids are unique so uses ee.Join.saveFirst.

Parameters:
  • primary (ee.Collection) – the first collection

  • secondary (ee.Collection) – the second collection

  • field (geetools.types.ee_str) – the field to join by

  • outer (bool) – whether to keep non matching features

Returns:

the joined collection

Return type:

ee.Collection

Example

import ee
import geetools

ee.Initialize()

point = ee.Geometry.Point([0,0])
prop1 = {'id': 1, 'prop_from_fc1': 'I am from fc1'}
prop2 = {'id': 1, 'prop_from_fc2': 'I am from fc2'}
fc1 = ee.FeatureCollection([ee.Feature(point, prop1)])
fc2 = ee.FeatureCollection([ee.Feature(point, prop2)])
joined = ee.Join.geetools.byProperty(fc1, fc2, 'id')
joined.getInfo()