HTTP 413 error on increasing data size in demo

filter_spatial with URL

It’s indeed not well documented, but you can pass a URL string directly to filter_spatial (instead of a geometry object. For example:

cube = cube.filter_spatial("https://raw.githubusercontent.com/Open-EO/openeo-python-driver/master/tests/data/geojson/FeatureCollection01.json")

While this client-side part should work, unfortunately the VITO/Terrascope back-end does not support remote URLs for the filter_spatial process yet

>>> cube = con.load_collection("TERRASCOPE_S2_TOC_V2", temporal_extent=["2021-09-01", "2021-09-15"])
>>> cube = cube.filter_spatial("https://raw.githubusercontent.com/Open-EO/openeo-python-driver/master/tests/data/geojson/FeatureCollection01.json")
>>> cube.download("tmp.nc")
OpenEoApiError: [500] unknown: filter_spatial only supports dict but got DelayedVector('https://raw.githubusercontent.com/Open-EO/openeo-python-driver/master/tests/data/geojson/FeatureCollection01.json')

I created a ticket for that at support DelayedVector in filter_spatial · Issue #112 · Open-EO/openeo-python-driver · GitHub

Workaround

As a workaround for the current situation: filter_spatial is practically the same as the combination of filter_bbox and mask_polygon. So if you know (or extract) the bounding box of the geometry you can achieve the same result.
For example, using a GeoJSON FeatureCollection from an URL, and extracting the total bounding box using GeoPandas:

import geopandas as gpd

geometry_url = "https://raw.githubusercontent.com/Open-EO/openeo-python-driver/master/tests/data/geojson/FeatureCollection01.json"

bbox = dict(zip(
    ["west", "south", "east", "north"], 
    gpd.read_file(geometry_url).total_bounds
))
temporal_extent = ["2021-09-01", "2021-09-15"]
cube = con.load_collection("TERRASCOPE_S2_TOC_V2", temporal_extent=temporal_extent)
cube = cube.filter_bbox(bbox)
cube = cube.mask_polygon(geometry_url)