@@ -264,18 +264,25 @@ def identify_stac_object_type(json_dict):
264
264
"""
265
265
object_type = None
266
266
267
- # Identify pre-1.0 ITEMCOLLECTION (since removed)
268
- if 'type' in json_dict and 'assets' not in json_dict :
269
- if 'stac_version' in json_dict and json_dict ['stac_version' ].startswith ('0' ):
270
- if json_dict ['type' ] == 'FeatureCollection' :
271
- object_type = STACObjectType .ITEMCOLLECTION
272
-
273
- if 'extent' in json_dict :
274
- object_type = STACObjectType .COLLECTION
275
- elif 'assets' in json_dict :
276
- object_type = STACObjectType .ITEM
277
- else :
278
- object_type = STACObjectType .CATALOG
267
+ if 'type' in json_dict : # Try to identify using 'type' property
268
+ for t in STACObjectType :
269
+ if json_dict ['type' ].lower () == t .value .lower ():
270
+ object_type = t
271
+ break
272
+
273
+ if object_type is None : # Use old-approach based on other properties
274
+ # Identify pre-1.0 ITEMCOLLECTION (since removed)
275
+ if 'type' in json_dict and 'assets' not in json_dict :
276
+ if 'stac_version' in json_dict and json_dict ['stac_version' ].startswith ('0' ):
277
+ if json_dict ['type' ] == 'FeatureCollection' :
278
+ object_type = STACObjectType .ITEMCOLLECTION
279
+
280
+ if 'extent' in json_dict :
281
+ object_type = STACObjectType .COLLECTION
282
+ elif 'assets' in json_dict :
283
+ object_type = STACObjectType .ITEM
284
+ else :
285
+ object_type = STACObjectType .CATALOG
279
286
280
287
return object_type
281
288
0 commit comments