Filter_spatial create datacubes which are wider than the input polygons

Hi all,
I want to create a Sentinel 2 Satellite Image Time Series on 30 different polygons described by a geojson. Each of the polygon belong to the same S2 tile and have the following dimension: 1280m*1280m. They were generated in the corresponding S2 tile UTM coordinate, then converted WGS 84.
To extract only time series on those defined polygons, I am using the function filter_spatial. The full code is given here:

import json
from pathlib import Path

import openeo
if __name__=="__main__":

    temporal_extent=TIMERANGE = ["2020-01-01", "2020-02-27"]
    OUTDIR = Path("/home/dumeuri/Documents/dataset/MMDC_OE")
    S2_BANDS = [
    if temporal_extent is None:
        temporal_extent = TIMERANGE

    connection = openeo.connect("")
    sentinel2 = connection.load_collection(
    "SENTINEL2_L2A_SENTINELHUB", temporal_extent=temporal_extent, bands=S2_BANDS

    with open(features) as feat:
        features = json.load(feat)
    datacube = sentinel2.filter_spatial(features)
    job = datacube.create_job(

I can also share the geojson file used if needed. The id of the job which has executed this code is: vito-j-f5f0d0cbdf5845649e392177b0261d5b

However, when I download the generated datacubes, I observe that the extent of the different Satellite Image Time Series (SITS) are wider than the polygons given. More precisely, outside the defined polygon, the Satellite Image Time Series is filled with no data. The following image displays the issue. In the image given below : in yellow the given polygon in the geojson file, outside the polygon the black color corresponds to no-data. In this example, contrary to expectations, the SITS is not 128pix128pix but 256pix512pix.

It should be noted that the extent is not always the same for the different polygons, I have observed for instance 256pix512pix, 512pix512pix, 256pix*256pix.
Therefore, I am wondering if I have misunderstood filter_spatial function. And is there another function which could enable me to crop the final SITS on the given polygon ?
Best regards,

Hi Iris,
my apologies for the late reply, I think what you are doing is correct, so we need to check a bit deeper if something’s wrong. Unfortunately, we didn’t get to it this week yet, hope to get back to you soon!

best regards,

Hi Iris,
after investigation, it turns out that for cubes with a time dimension, the cropping to feature bounds was indeed missing, I now added this, so that it’s the same behavior as without time dimension.

The fix still needs to be tested, should we assume you are blocked by this (and try to roll out fast)?

Thank you very much for your answer. I have currently done a quick fix, by clipping the data to the correct geometry after downloading them. I am interested in this fix, but it is not a blocking point.
Best regards,

Hi Iris,
The issue has been fixed and is currently live on the backend.

Best regards,

1 Like