@@ -37,15 +37,15 @@ def db_to_stac(cls, item: dict, base_url: str) -> stac_types.Item:
37
37
38
38
return stac_types .Item (
39
39
type = "Feature" ,
40
- stac_version = item ["stac_version" ],
41
- stac_extensions = item ["stac_extensions" ] or [],
42
- id = item [ "id" ] ,
43
- collection = item ["collection" ],
44
- geometry = item ["geometry" ],
45
- bbox = item ["bbox" ],
46
- properties = item ["properties" ],
47
- links = item_links ,
48
- assets = item ["assets" ],
40
+ stac_version = item ["stac_version" ] if "stac_version" in item else "" ,
41
+ stac_extensions = item ["stac_extensions" ] if "stac_extensions" in item else [],
42
+ id = item_id ,
43
+ collection = item ["collection" ] if "collection" in item else "" ,
44
+ geometry = item ["geometry" ] if "geometry" in item else {} ,
45
+ bbox = item ["bbox" ] if "bbox" in item else [] ,
46
+ properties = item ["properties" ] if "properties" in item else {} ,
47
+ links = item_links if "links" in item else [] ,
48
+ assets = item ["assets" ] if "assets" in item else {} ,
49
49
)
50
50
51
51
@@ -63,20 +63,17 @@ def db_to_stac(cls, collection: dict, base_url: str) -> stac_types.Collection:
63
63
if original_links :
64
64
collection_links += resolve_links (original_links , base_url )
65
65
66
- if "providers" not in collection :
67
- collection ["providers" ] = {}
68
-
69
66
return stac_types .Collection (
70
67
type = "Collection" ,
71
68
id = collection ["id" ],
72
- stac_extensions = collection ["stac_extensions" ] or [],
73
- stac_version = collection ["stac_version" ],
74
- title = collection ["title" ],
75
- description = collection ["description" ],
76
- keywords = collection ["keywords" ],
77
- license = collection ["license" ],
78
- providers = collection ["providers" ],
79
- summaries = collection ["summaries" ],
80
- extent = collection ["extent" ],
69
+ stac_extensions = collection ["stac_extensions" ] if "stac_extensions" in collection else [],
70
+ stac_version = collection ["stac_version" ] if "stac_version" in collection else "" ,
71
+ title = collection ["title" ] if "title" in collection else "" ,
72
+ description = collection ["description" ] if "description" in collection else "" ,
73
+ keywords = collection ["keywords" ] if "keywords" in collection else [] ,
74
+ license = collection ["license" ] if "license" in collection else "" ,
75
+ providers = collection ["providers" ] if "providers" in collection else {} ,
76
+ summaries = collection ["summaries" ] if "summaries" in collection else {} ,
77
+ extent = collection ["extent" ] if "extent" in collection else {} ,
81
78
links = collection_links ,
82
79
)
0 commit comments