Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle already existing collection.json #532

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

ajacombs
Copy link
Contributor

@ajacombs ajacombs commented Jul 3, 2023

If the collection_from_items.py is run with a --uri source of an S3 path which already contains a collection.json file which is the output of a previous run of the script, it will fail.

This is because of a KeyError exception for "collection", which all the item STAC files have, but which the resulting collection.json file does not, as the collection ID is instead stored in the "id" key.

Swapping from item_stac["collection"] to item_stac.get("collection") eliminates this KeyError exception, and allows the script to run happily with a previously existing collection.json file, as it will be skipped and then overwritten.

@ajacombs ajacombs requested a review from a team as a code owner July 3, 2023 03:51
@amfage amfage added this pull request to the merge queue Jul 4, 2023
Merged via the queue into master with commit 7a26bae Jul 4, 2023
@amfage amfage deleted the fix/handle-existing-collection-json branch July 4, 2023 03:16
@github-actions github-actions bot mentioned this pull request Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants