The object-based method described here helps uniquely label the hotspot in image objects.

// Uniquely label the hotspot image objects.
var objectId = hotspots.connectedComponents({
  connectedness: ee.Kernel.plus(1),
  maxSize: 128

If each object now has a unique ID, my question is how to print out all the labels and count the number of unique IDs that have been identified?


reduceRegion with a countDistinct reducer.

var count = objectId.reduceRegion({reducer: ee.Reducer.countDistinct(), ...})
  • Thank you! @Noel Gorelick Jul 9 '21 at 23:47

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.