Google Earth Engine – Troubleshooting ReduceRegions Not Returning Values in Google Earth Engine

google-earth-enginegoogle-earth-engine-python-apiland-coverreduceregion

I am trying to reduce the percentage of crops from the CGLS-100 Landcover dataset for a set of points uploaded as asset from a shapefile. This is an operation that I've done tens of times, but for some reason in this particular instance reduceRegions doesn't return any value from the image – only the fields from the original shapefile. I need someone to check my sanity:

# Load landcover
LC = ee.ImageCollection("COPERNICUS/Landcover/100m/Proba-V-C3/Global")\
    .filterDate('2015-01-01', '2015-12-31').first().select(['crops-coverfraction'])

# Load POIs
POI = ee.FeatureCollection('users/sebastienbiasse/barangays')

# Produce buffer around POIs
POI = POI.select(['NAME_1', 'NAME_2', 'NAME_3']).map(lambda feat: ee.Feature(feat).buffer(1000))

# Reduce
col = LC.reduceRegions(collection=POI, reducer=ee.Reducer.mean(), scale=100)

# Remove geometry
col = col.map(lambda feat: feat.setGeometry())

# Request GEE to perform its magics
ee.batch.Export.table.toDrive(collection=col, description=f'LC_crops8', folder='CALDERA', fileFormat="CSV").start()

No error is returned, but the output csv file contains only the fields system:index, NAME_1, NAME_2, NAME_3, and .geo. I expect a field called crops-coverfraction as requested. Other SO answers to similar problems suggest that one source of error could be the size of the featureCollection and mine happens to be rather large (84k points). I get the same problem when using this instead:

ee.batch.Export.table.toDrive(collection=col.limit(1000), description=f'LC_crops8', folder='CALDERA', fileFormat="CSV").start()

Can anyone spot an error?

The bizarre thing is that I reduce another image ~10 lines above this and it works perfectly.

Best Answer

I don't usually work with Python so I worked out a solution directly on the GEE code editor. From what I can gather, there are two things that are messing up your code:

First, I think you might have to limit the number of properties to something ≤5000, though this might not be the case when exporting the results to the Drive.

Second, for reasons unbeknownst to myself, reduceRegions needs a crs projection (even though it's supposedly optional) to work in this case.

Here's the GEE code I wrote to test your python code: https://code.earthengine.google.com/ee203842d4f9020ee718f1f6fb8451b7