2

I want to get the properties of a feature. How can I do that? In the example below we can get one of the properties out like so feature.get('species'). How can we get all of them at once? This is a failure feature.get('properties')

It works for geometry like feature.geometry() but not for properties.

// Make a feature and set some properties.
var feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605]))
  .set('genus', 'Sequoia').set('species', 'sempervirens');

// Get a property from the feature.
print(feature.get('species'));

print(feature.get('properties'));
2
//dictionary of property names and values
print(feature.toDictionary())

//or list of either property names or values
print(feature.toDictionary().keys())
print(feature.toDictionary().values())


| improve this answer | |
  • fantastic. Thanks – OverFlow Police Feb 18 at 3:14
  • print(feature.toDictionary(feature.propertyNames())) if you also want the system properties – Kuik Feb 19 at 0:41

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.