0

I have uploaded a table containing information on river basins within countries (https://code.earthengine.google.com/?asset=users/basins/TFDD_BCU). I want to calculate the mean population density in the basins from this image:

var Pop1975 = ee.Image('JRC/GHSL/P2016/POP_GPW_GLOBE_V1/1975');

I have tried this code:

var BCU = ee.FeatureCollection('users/basins/TFDD_BCU');

var Pop1975mean = Pop1975.reduceRegions({
  collection: BCU,
  reducer: ee.Reducer.mean(),
  scale: 500,
});

Export.table.toDrive({
  collection: ee.FeatureCollection([
  ee.Feature(null, Pop1975mean)
  ]),
  description: 'Pop1975mean',
  fileFormat: 'CSV'
});

When running the export to the drive the process is stopped after a short while, reporting an 'internal error' but no additional information. Is the dataset too large or is there a mistake in the code?

  • 1
    what is the error message? – Ian Turton May 23 at 10:22
  • When running the export to the drive after less than a minute it says: State: Failed & Error: Internal error – Sven Christens May 24 at 9:17
0

The output of reduceRegions is a feature collection, thus, this export should work:

Export.table.toDrive({
  collection: Pop1975mean,
  description: 'Pop1975mean',
  fileFormat: 'CSV'
});

By applyging reduceRegion() on the BCU, your output will be a dictionary and your Export assignment would be correct if BCU is a variable.

Hope this works, otherwise, make share a link of your code and give access to your feature collection.

  • It works well. Thanks a lot! But I didn't expect to have missing missing values for most observations as the image covers the whole world. I felt like this is a different problem, so I opened a new question: here – Sven Christens May 27 at 7:55

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.