I have upload a kml file including main metropolitans in us as a fusion table, I can print the featurecollection but cann't visualize it in code editor.What's wrong with my code?

var fc = ee.FeatureCollection('ft:1Eii75QFBlQcYILLBFsU6zv9LhgJLa8FPHNGSZijQ')

Map.addLayer(fc, {}, 'metro');


2 Answers 2


You can specify the property to use as the geometry by passing it as the second parameter to ee.FeatureCollection:

var fc = ee.FeatureCollection('ft:1Eii75QFBlQcYILLBFsU6zv9LhgJLa8FPHNGSZijQ', "geometry")
  • Awesome! Brief answer makes a big difference!
    – Jsun
    Feb 21, 2019 at 17:39

Somehow, you uploaded that KML file with the geometry set as a property of the feature, instead of the actual geometry of that feature. With this code, you can get the geometry of the property of each feature, return each feature with it's other properties and the geometry set as geometry:

var withGeometry = fc.map(function(feat){
  var geom = ee.Geometry(feat.get('geometry'));
  var propNames = feat.propertyNames().remove('geometry');
  var props = feat.toDictionary(propNames);
  return ee.Feature(geom, props);
Map.addLayer(withGeometry.draw('red'),{}, 'feat collection')



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.