Skip to content

Commit

Permalink
assert that both "id" and "properties.id" are considered
Browse files Browse the repository at this point in the history
  • Loading branch information
bossie committed Sep 20, 2022
1 parent b2b888c commit 2d0b27e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions openeo_driver/datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def from_fiona(cls, paths: List[str], driver: str, options: dict) -> "DriverVect
# TODO #114 EP-3981: support multiple paths
raise FeatureUnsupportedException(message="Loading a vector cube from multiple files is not supported")
# TODO #114 EP-3981: lazy loading like/with DelayedVector
# note for GeoJSON: will consider Feature.id as well as Feature.properties.id
return cls(geometries=gpd.read_file(paths[0], driver=driver))

@classmethod
Expand Down
41 changes: 41 additions & 0 deletions tests/data/geojson/FeatureCollection05.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "first",
"properties": {
"pop": 1234
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[1, 1],
[3, 1],
[2, 3],
[1, 1]
]
]
}
},
{
"type": "Feature",
"id": "second",
"properties": {
"pop": 5678
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[4, 2],
[5, 4],
[3, 4],
[4, 2]
]
]
}
}
]
}
8 changes: 6 additions & 2 deletions tests/test_views_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,12 @@ def test_aggregate_spatial_invalid_geometry(api100, geometries, expected):
_ = api100.result(pg).assert_error(400, "ProcessParameterInvalid", expected)


def test_aggregate_spatial_vector_cube_basic(api100):
path = get_path("geojson/FeatureCollection02.json")
@pytest.mark.parametrize(["feature_collection_test_path"], [
["geojson/FeatureCollection02.json"],
["geojson/FeatureCollection05.json"]
])
def test_aggregate_spatial_vector_cube_basic(api100, feature_collection_test_path):
path = get_path(feature_collection_test_path)
pg = {
"lc": {"process_id": "load_collection", "arguments": {"id": "S2_FOOBAR", "bands": ["B02", "B03", "B04"]}},
"lf": {
Expand Down

0 comments on commit 2d0b27e

Please sign in to comment.