Skip to content

Commit 03a632c

Browse files
authored
Merge branch 'main' into pyupgrade
2 parents 224bae2 + 1b16191 commit 03a632c

File tree

18 files changed

+966
-1
lines changed

18 files changed

+966
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- `Client.get_collection` for static catalogs [#782](https://github.com/stac-utils/pystac-client/pull/782)
13+
1014
## [v0.8.5] - 2024-10-23
1115

1216
### Fixed

pystac_client/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def get_collection(self, collection_id: str) -> Collection | CollectionClient:
389389
Raises:
390390
NotFoundError if collection_id does not exist.
391391
"""
392-
collection: Collection | CollectionClient
392+
collection: Collection | CollectionClient | None = None
393393

394394
if self._supports_collections():
395395
assert self._stac_io is not None
@@ -406,6 +406,11 @@ def get_collection(self, collection_id: str) -> Collection | CollectionClient:
406406
for collection in super().get_collections():
407407
if collection.id == collection_id:
408408
call_modifier(self.modifier, collection)
409+
break
410+
411+
if collection is None:
412+
raise KeyError(f"Collection {collection_id} not found on catalog")
413+
409414
return collection
410415

411416
def get_collections(self) -> Iterator[Collection]:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "Catalog",
3+
"id": "test",
4+
"stac_version": "1.1.0",
5+
"description": "test catalog",
6+
"links": [
7+
{
8+
"rel": "child",
9+
"href": "./country-1/catalog.json",
10+
"type": "application/json"
11+
},
12+
{
13+
"rel": "child",
14+
"href": "./country-2/catalog.json",
15+
"type": "application/json"
16+
},
17+
{
18+
"rel": "root",
19+
"href": "./catalog.json",
20+
"type": "application/json"
21+
}
22+
],
23+
"stac_extensions": []
24+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"type": "Feature",
3+
"stac_version": "1.1.0",
4+
"id": "area-1-1-imagery",
5+
"properties": {
6+
"datetime": "2019-10-04T18:55:37Z"
7+
},
8+
"geometry": {
9+
"type": "Polygon",
10+
"coordinates": [
11+
[
12+
[
13+
-2.5048828125,
14+
3.8916575492899987
15+
],
16+
[
17+
-1.9610595703125,
18+
3.8916575492899987
19+
],
20+
[
21+
-1.9610595703125,
22+
4.275202171119132
23+
],
24+
[
25+
-2.5048828125,
26+
4.275202171119132
27+
],
28+
[
29+
-2.5048828125,
30+
3.8916575492899987
31+
]
32+
]
33+
]
34+
},
35+
"links": [
36+
{
37+
"rel": "collection",
38+
"href": "../collection.json",
39+
"type": "application/json"
40+
},
41+
{
42+
"rel": "root",
43+
"href": "../../../catalog.json",
44+
"type": "application/json"
45+
},
46+
{
47+
"rel": "parent",
48+
"href": "../collection.json",
49+
"type": "application/json"
50+
}
51+
],
52+
"assets": {
53+
"ortho": {
54+
"href": "http://example.com/area-1-1_ortho.tif",
55+
"type": "image/vnd.stac.geotiff"
56+
},
57+
"dsm": {
58+
"href": "http://example.com/area-1-1_dsm.tif",
59+
"type": "image/vnd.stac.geotiff"
60+
}
61+
},
62+
"bbox": [
63+
-2.5048828125,
64+
3.8916575492899987,
65+
-1.9610595703125,
66+
3.8916575492899987
67+
],
68+
"stac_extensions": [],
69+
"collection": "area-1-1"
70+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"type": "Feature",
3+
"stac_version": "1.1.0",
4+
"id": "area-1-1-labels",
5+
"properties": {
6+
"datetime": "2019-10-04T18:55:37Z",
7+
"label:description": "labels for area-1-1",
8+
"label:type": "vector",
9+
"label:properties": [
10+
"label"
11+
],
12+
"label:classes": [
13+
{
14+
"name": "label",
15+
"classes": [
16+
"one",
17+
"two"
18+
]
19+
}
20+
],
21+
"label:tasks": [
22+
"classification"
23+
],
24+
"label:methods": [
25+
"manual"
26+
]
27+
},
28+
"geometry": {
29+
"type": "Polygon",
30+
"coordinates": [
31+
[
32+
[
33+
-2.5048828125,
34+
3.8916575492899987
35+
],
36+
[
37+
-1.9610595703125,
38+
3.8916575492899987
39+
],
40+
[
41+
-1.9610595703125,
42+
4.275202171119132
43+
],
44+
[
45+
-2.5048828125,
46+
4.275202171119132
47+
],
48+
[
49+
-2.5048828125,
50+
3.8916575492899987
51+
]
52+
]
53+
]
54+
},
55+
"links": [
56+
{
57+
"rel": "source",
58+
"href": "../area-1-1-imagery/area-1-1-imagery.json",
59+
"type": "application/json"
60+
},
61+
{
62+
"rel": "collection",
63+
"href": "../collection.json",
64+
"type": "application/json"
65+
},
66+
{
67+
"rel": "root",
68+
"href": "../../../catalog.json",
69+
"type": "application/json"
70+
},
71+
{
72+
"rel": "parent",
73+
"href": "../collection.json",
74+
"type": "application/json"
75+
}
76+
],
77+
"assets": {
78+
"labels": {
79+
"href": "http://example.com/area-1-1-labels.geojson",
80+
"type": "application/geo+json"
81+
}
82+
},
83+
"bbox": [
84+
-2.5048828125,
85+
3.8916575492899987,
86+
-1.9610595703125,
87+
3.8916575492899987
88+
],
89+
"stac_extensions": [
90+
"https://stac-extensions.github.io/label/v1.0.1/schema.json"
91+
],
92+
"collection": "area-1-1"
93+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"type": "Collection",
3+
"id": "area-1-1",
4+
"stac_version": "1.1.0",
5+
"description": "test collection country-1",
6+
"links": [
7+
{
8+
"rel": "item",
9+
"href": "./area-1-1-imagery/area-1-1-imagery.json",
10+
"type": "application/json"
11+
},
12+
{
13+
"rel": "item",
14+
"href": "./area-1-1-labels/area-1-1-labels.json",
15+
"type": "application/json"
16+
},
17+
{
18+
"rel": "root",
19+
"href": "../../catalog.json",
20+
"type": "application/json"
21+
},
22+
{
23+
"rel": "parent",
24+
"href": "../catalog.json",
25+
"type": "application/json"
26+
}
27+
],
28+
"stac_extensions": [],
29+
"extent": {
30+
"spatial": {
31+
"bbox": [
32+
[
33+
-2.5048828125,
34+
3.8916575492899987,
35+
-1.9610595703125,
36+
4.275202171119132
37+
]
38+
]
39+
},
40+
"temporal": {
41+
"interval": [
42+
[
43+
"2019-10-04T18:55:37Z",
44+
null
45+
]
46+
]
47+
}
48+
},
49+
"license": "other"
50+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"type": "Feature",
3+
"stac_version": "1.1.0",
4+
"id": "area-1-2-imagery",
5+
"properties": {
6+
"datetime": "2019-10-04T18:55:37Z"
7+
},
8+
"geometry": {
9+
"type": "Polygon",
10+
"coordinates": [
11+
[
12+
[
13+
-2.5048828125,
14+
3.8916575492899987
15+
],
16+
[
17+
-1.9610595703125,
18+
3.8916575492899987
19+
],
20+
[
21+
-1.9610595703125,
22+
4.275202171119132
23+
],
24+
[
25+
-2.5048828125,
26+
4.275202171119132
27+
],
28+
[
29+
-2.5048828125,
30+
3.8916575492899987
31+
]
32+
]
33+
]
34+
},
35+
"links": [
36+
{
37+
"rel": "collection",
38+
"href": "../collection.json",
39+
"type": "application/json"
40+
},
41+
{
42+
"rel": "root",
43+
"href": "../../../catalog.json",
44+
"type": "application/json"
45+
},
46+
{
47+
"rel": "parent",
48+
"href": "../collection.json",
49+
"type": "application/json"
50+
}
51+
],
52+
"assets": {
53+
"ortho": {
54+
"href": "http://example.com/area-1-2_ortho.tif",
55+
"type": "image/vnd.stac.geotiff"
56+
},
57+
"dsm": {
58+
"href": "http://example.com/area-1-2_dsm.tif",
59+
"type": "image/vnd.stac.geotiff"
60+
}
61+
},
62+
"bbox": [
63+
-2.5048828125,
64+
3.8916575492899987,
65+
-1.9610595703125,
66+
3.8916575492899987
67+
],
68+
"stac_extensions": [],
69+
"collection": "area-1-2"
70+
}

0 commit comments

Comments
 (0)