1

I tried to filter a FeatureCollection based on a property i.e. where "Condition" == "Suitable", and count the number of features returned. This is the code I tried.

suitable_Features = irrigation_Cond.filterMetadata('Condition',"equals",'Suitable')
    suitable_Features.size().getInfo()

I got this error

HttpError                                 Traceback (most recent call last)
~\Anaconda3\lib\site-packages\ee\data.py in _execute_cloud_call(call, num_retries)
    333   try:
--> 334     return call.execute(num_retries=num_retries)
    335   except googleapiclient.errors.HttpError as e:

~\Anaconda3\lib\site-packages\googleapiclient\_helpers.py in positional_wrapper(*args, **kwargs)
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 

~\Anaconda3\lib\site-packages\googleapiclient\http.py in execute(self, http, num_retries)
    914         if resp.status >= 300:
--> 915             raise HttpError(resp, content, uri=self.uri)
    916         return self.postproc(resp, content)

HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Collection.reduceColumns: Error in map(ID=000000000000000006b6):
Number.gte: Parameter 'left' is required.">

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
<ipython-input-80-2f4a623ea954> in <module>()
----> 1 suitable_Features.size().getInfo()

~\Anaconda3\lib\site-packages\ee\computedobject.py in getInfo(self)
     93       The object can evaluate to anything.
     94     """
---> 95     return data.computeValue(self)
     96 
     97   def encode(self, encoder):

~\Anaconda3\lib\site-packages\ee\data.py in computeValue(obj)
    676           body={'expression': serializer.encode(obj, for_cloud_api=True)},
    677           project=_get_projects_path(),
--> 678           prettyPrint=False))['result']
    679 
    680 

~\Anaconda3\lib\site-packages\ee\data.py in _execute_cloud_call(call, num_retries)
    334     return call.execute(num_retries=num_retries)
    335   except googleapiclient.errors.HttpError as e:
--> 336     raise _translate_cloud_exception(e)
    337 
    338 

EEException: Collection.reduceColumns: Error in map(ID=000000000000000006b6):
Number.gte: Parameter 'left' is required.
2
1

The issue doesn't seem to be related to .filterMetadata, but rather to the .reduceColumns that you are calling on the original collection. Without the collection available for testing it's hard to reproduce, but my hunch would be that the property of interest is missing in at least one of the features in your collection.

Try using .filter(ee.Filter.notNull(['propertyOfInterest'])) before calling .filterMetadata.

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.