stac-utils / stac-check

Linting and validation tool for STAC assets
MIT License
17 stars 5 forks source link

KeyError: 'bbox' #104

Open philvarner opened 1 year ago

philvarner commented 1 year ago

Sorry I don't have a more precise use case here. I'm running stac-api-validator against tamn.snapplanet.io/, and I don't know which item this occurs against.

The stacktrace is:

File "/Users/philvarner/code/stac-api-validator/.venv/lib/python3.10/site-packages/stac_check/lint.py", line 42, in __post_init__
    self.best_practices_msg = self.create_best_practices_msg()
  File "/Users/philvarner/code/stac-api-validator/.venv/lib/python3.10/site-packages/stac_check/lint.py", line 271, in create_best_practices_msg
    for _,v in self.create_best_practices_dict().items():
  File "/Users/philvarner/code/stac-api-validator/.venv/lib/python3.10/site-packages/stac_check/lint.py", line 230, in create_best_practices_dict
    if self.check_unlocated() and config["check_unlocated"] == True:
  File "/Users/philvarner/code/stac-api-validator/.venv/lib/python3.10/site-packages/stac_check/lint.py", line 131, in check_unlocated
    return self.data["geometry"] is None and self.data["bbox"] is not None
KeyError: 'bbox'

My guess is that this is because bbox is only required if geometry is null, so this line should be more defensive like return self.data.get("geometry") is None and self.data.get("bbox") is not None

jonhealy1 commented 1 year ago

Ok thanks for the feedback. I will make the change