0

I'm using a FeatureCollection and I would like to discover the column names as a ee.List. Looking at the documentation, I only find ways to reduce them but you need to know their names.

For example from:

var collection = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point(77.58, 13), {date:'2020-10-02', count:1, x:1}),
  ee.Feature(ee.Geometry.Point(77.58, 13), {date:'2020-10-04', count:1, x:1}),
  ee.Feature(ee.Geometry.Point(77.58, 13), {date:'2020-10-02', count:3, x:0}),
  ee.Feature(ee.Geometry.Point(77.58, 13), {date:'2020-10-01', count:2, x:0})
]);

I would like to extract

ee.List(["system:index", "date", "count", "x"])

1 Answer 1

0

If the collection is consistent (i.e. all features have the same properties) then you can do:

var columns = collection.first().propertyNames()

as shown in https://code.earthengine.google.com/a10ccab842d428904b1fe46f3aa71a17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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