Logo
  • Home

Tutorials

  • Translate your first filter

How-to guides

  • Search the catalogue
  • Convert responses
  • Develop and preview documentation

Reference

  • Python API
  • Operators
  • Attributes
  • CLI
  • OData-STAC crosswalk
  • Container builds
  • Example notebooks
    • pygeofilter CDSE OData support for CQL2
      • Scope
      • Target
      • Usage
      • Disclaimer
    • Supported Comparison operators
    • Spatial operators
    • Temporal operators

Explanation

  • Translation and conversion
pygeofilter CDSE OData support for CQL2
  • Reference
  • Example notebooks
  • pygeofilter CDSE OData support for CQL2
  • Edit on Terradue/pygeofilter-odata-cdse

pygeofilter CDSE OData support for CQL2¶

Scope¶

We aim to provide users a simpler OData Filtering experience by let them expressing a $filter via Common Query Language (also known as CQL2).

Target¶

This library, written in Python, is developed to simplify System Integrators daily routines to interact with Geospatial catalogs, such as the Copernicus Data Space Ecosystem.

Usage¶

Once the library is installed, everything required are the following steps:

In [ ]:
Copied!
import json
from pygeocdse.evaluator import http_invoke

# define the OData catalog base URL

base_url = "https://catalogue.dataspace.copernicus.eu/odata/v1/Products"

# define the OData filter, according to CQL2 (JSON)

cql2_filter = {
    "op": "and",
    "args": [
        {
            "op": "eq",
            "args": [
                {"property": "Collection/Name"},
                "SENTINEL-2"
            ]
        },
        {
            "op": "eq",
            "args": [
                {"property": "productType"},
                "S2MSI1C"
            ]
        },
        {
            "op": "s_intersects",
            "args": [
                {"property": "geometry"},
                {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [-11, 35],
                            [27.5, 35],
                            [27.5, 60],
                            [-11, 60],
                            [-11, 35],
                        ]
                    ],
                },
            ],
        }
    ],
}

# Now query the OData Catalog via HTTP

data = http_invoke(base_url, cql2_filter)

# manipulate resulting data

print(json.dumps(data, indent=2))
import json from pygeocdse.evaluator import http_invoke # define the OData catalog base URL base_url = "https://catalogue.dataspace.copernicus.eu/odata/v1/Products" # define the OData filter, according to CQL2 (JSON) cql2_filter = { "op": "and", "args": [ { "op": "eq", "args": [ {"property": "Collection/Name"}, "SENTINEL-2" ] }, { "op": "eq", "args": [ {"property": "productType"}, "S2MSI1C" ] }, { "op": "s_intersects", "args": [ {"property": "geometry"}, { "type": "Polygon", "coordinates": [ [ [-11, 35], [27.5, 35], [27.5, 60], [-11, 60], [-11, 35], ] ], }, ], } ], } # Now query the OData Catalog via HTTP data = http_invoke(base_url, cql2_filter) # manipulate resulting data print(json.dumps(data, indent=2))

Disclaimer¶

This is Work in Progress, only a limited subset of OData operators are supported for CDSE use cases only.

Contributions are welcome and appreciated.

Previous Next

Apache License, Version 2.0

Built with MkDocs using a theme provided by Read the Docs.
Terradue/pygeofilter-odata-cdse « Previous Next »