Open-EO/openeo-r-client

Improve meta data filtering on load_collection

Closed this issue · 2 comments

flahn commented

https://discuss.eodc.eu/t/setting-a-cloudfilter-in-load-collections/145

There is a new subtype metadata-filter that is not yet covered. This results in very poor user experience regarding something like filtering scenes in terms of cloud coverage. Maybe @m-mohr can provide some details and examples, how the JSON should look like.

I think overloading the logical operators would be nice if possible. This would allow to get something like:

filter = list(
  "eo:cloud_cover" = function(x) x >= 0 && x < 50, # or function(x, builder) builder$between(x, 0, 50)
  "platform" = function(x) x == "Sentinel-2A"
)

It seems there's already something similar available: https://discuss.eodc.eu/t/generating-a-cloud-mask-using-the-r-client/109/4?u=m-mohr

The resulting JSON would be for example:

{
  "eo:cloud_cover": {
    "process_graph": {
      "2": {
        "process_id": "gte",
        "arguments": {
          "x": {
            "from_parameter": "x"
          },
          "y": 0
        }
      },
      "3": {
        "process_id": "lt",
        "arguments": {
          "x": {
            "from_parameter": "x"
          },
          "y": 50
        }
      },
      "4": {
        "process_id": "and",
        "arguments": {
          "x": {
            "from_node": "3"
          },
          "y": {
            "from_node": "2"
          }
        },
        "result": true
      }
    }
  },
  "platform": {
    "process_graph": {
      "1": {
        "process_id": "eq",
        "arguments": {
          "x": {
            "from_parameter": "x"
          },
          "y": "Sentinel-2A"
        },
        "result": true
      }
    }
  }
}