0

IMPORTS:

var geometry = /* color: #98ff00 */ee.Geometry.Polygon(
    [[[73.85016678395664, 14.304113379426035],
      [73.85016583974448, 14.048667693939866],
      [74.0477686190103, 14.155139129529527]]]),
    point1 = /* color: #d63000 */ee.Geometry.Point([73.91532897949219, 14.20980182205916]),
    point2 = /* color: #98ff00 */ee.Geometry.MultiPoint(
    [[73.9105224609375, 14.169860112219006],
     [73.87619018554688, 14.186503346854852],
     [73.87550354003906, 14.233097898500935],
     [73.93730163574219, 14.199817054773131],
     [73.95378112792969, 14.181177644664091],
     [73.88717651367188, 14.155213055929545],
     [73.92906188964844, 14.141230893912757],
     [73.94691467285156, 14.155878851710582],
     [73.97300720214844, 14.161205147702967],
     [73.98399353027344, 14.165865554216062],
     [73.9764404296875, 14.197820048470204]]);

CODE:

var image = ee.ImageCollection("LANDSAT/LC8_L1T_TOA").filterBounds(geometry)
.filterDate('2013-01-01', '2013-04-14');

var addNDWI = function(image) {
var ndwi = image.normalizedDifference(['B3', 'B6']).rename('NDWI');
return image.addBands(ndwi);
};
var image1 = image.map(addNDWI);

var fg_points = 
[ee.Feature(geometry),ee.Feature(point1),ee.Feature(point2)];
Map.addLayer(fg_points);

var mapfunc = function(feat) {
var geom = feat.geometry()
var addProp = function(img, f) {
var newf = ee.Feature(f)
var date = img.date().format()
var value = img.reduceRegion(ee.Reducer.first(), geom, 30).get('NDWI')
return ee.Feature(ee.Algorithms.If(value,
                                   newf.set(date, ee.String(value)),
                                   newf.set(date, ee.String('No data'))))
}
var newfeat = ee.Feature(image1.iterate(addProp, feat))
return newfeat
};


var newft = fg_points.map(mapfunc);

Export.table.toDrive(newft,
"export_Points",
"export_Points",
"export_Points");

Can someone explain where I am doing it wrong?

1 Answer 1

0

The Map.addLayer() method does not accept the type of parameter you passed to it (i.e. a JavaScript list of ee.Geometry objects).

That being said, I agree that the current error message ("f.eeObject.name is not a function") is not helpful in understanding the cause.

To avoid the error, you can add the features as separate map layers:

Map.addLayer(ee.Feature(geometry), {}, "geometry");
Map.addLayer(ee.Feature(point1), {}, "point1");
Map.addLayer(ee.Feature(point2), {}, "point2");
1
  • Thanks for the previous one. Now it is showing a new error which says ' d.fc is not a function '. Can you please check that. Commented Jul 20, 2018 at 21:32

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.