Open-EO / openeo-web-editor

An interactive and easy to use web-based editor for the OpenEO API.
https://editor.openeo.org
Apache License 2.0
12 stars 17 forks source link

Code Export: Support generating metadata filters #259

Open m-mohr opened 2 years ago

m-mohr commented 2 years ago

Currently, metadata-filters don't get generated:

The following process:

{
  "process_graph": {
    "load_collection_LUCZT2231M": {
      "process_id": "load_collection",
      "arguments": {
        "bands": [
          "B08",
          "B04",
          "B02"
        ],
        "id": "SENTINEL2_L2A",
        "properties": {},
        "spatial_extent": {
          "east": 6.646557,
          "north": 50.82171,
          "south": 50.811346,
          "west": 6.631536
        },
        "temporal_extent": [
          "2018-01-01",
          "2019-01-01"
        ]
      },
      "description": "B08 = NIR, B04 = RED, B02 = BLUE"
    },
    "save_result_ZZGVZ2715G": {
      "process_id": "save_result",
      "arguments": {
        "data": {
          "from_node": "load_collection_LUCZT2231M"
        },
        "format": "GTiff"
      },
      "result": true
    }
  },
  "parameters": []
}

results in incomplete code:

// Import required packages
import { OpenEO, Formula } from '@openeo/js-client';

// Connect to the back-end
let connection = await OpenEO.connect('https://openeo.vito.be');
// ToDo: Here you need to add your authentication steps

let builder = await connection.buildProcess();

// B08 = NIR, B04 = RED, B02 = BLUE
let load_collection_LUCZT2231M = builder.load_collection("SENTINEL2_L2A",
  {"east": 6.646557, "north": 50.82171, "south": 50.811346, "west": 6.631536},
  ["2018-01-01", "2019-01-01"], ["B08", "B04", "B02"],
  {} // <-- Filters missing
);
let save_result_ZZGVZ2715G = builder.save_result(load_collection_LUCZT2231M, "GTiff");

// The process can be executed synchronously (see below), as batch job or as web service now
let result = await connection.computeResult(save_result_ZZGVZ2715G);

(applies to all languages)

m-mohr commented 2 years ago

Fixed, but only for filters in load_collection properties.