When I create a feature with a property that has a null-value, that property disappears when adding the feature to a feature-collection. Why does this happen and how to prevent this?
An example (https://code.earthengine.google.com/5dd388c75939997f4d50d0e6628e1c22):
var dict1 = ee.Dictionary({'prop1': null, 'prop2': 400})
print(dict1);
var ft1 = ee.Feature(null, dict1)
print(ft1)
var ftc1 = ee.FeatureCollection(ft1)
print(ftc1)
"dict1" has two items, one of the values is "null". Creating a feature with this dictionary gives a feature "ft1", that has two properties. When adding "ft1" to a feature-collection, the property that has a null-value disappears from the feature.
Best Answer
I got an answer by Noel Gorelick in the GEE Developers Group:
So, why it happens: it's the method to remove properties from a feature.
How to prevent it: Set the null-value to some other value.
An example on how to do that:
This question is also related to this one: Creating a time-series from an image-collection in GEE including null-values in case all pixels are masked