I want to run an analysis over a FeatureCollection. It works perfectly, if I create the collection in GEE:

var p1 = ee.Geometry.Point([-122.64550158728298,38.44643840127136]);
var p2 = ee.Geometry.Point([-123.06960473413164,38.54089331487732]);
var p3 = ee.Geometry.Point([-122.85149523962673,38.33988067525676]);
var asset_points = ee.FeatureCollection(ee.List([ee.Feature(p1),ee.Feature(p2),ee.Feature(p3)]));

However, if I load a shapefile from my asset it fails:

var asset_points = ee.FeatureCollection("users/slisovski/AssetPoints");

The problem is making a Feature in L76:80:

ee.Feature(geom, {date:   image.date(),
                  name:   featname,
                  fitted: valF,
                  orig:   valO});

With the error: Error in map(ID=2_0): String: Parameter 'input' is required.


When such an error occurs in a mapping function, make sure to get that feature/image with the error, and apply the similar code without the mapping. Then you can print your variables within the mapping function and analyse where the error came from.

var testImage = mm.filter(ee.Filter.eq('system:index', '2_1')).first();

You would then have seen that in that image, your key Original was null. That gives an error, because an ee.String cannot have null as input. An useful workaround is apply combine() on the dictionary output with an empty dictionary. The function combine() removes null values from a dictionary.

var valueF = testImage.reduceRegion(ee.Reducer.median(), geom, 30)
    // remove null values using 'combine'. 
    // Combine a dictionary with an empty dictionary, and null values are removed
    .combine(ee.Dictionary()) // make line green to see error
print('1', valueF)

Now you will be able to apply the mapping. See link


This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .