AWS STAC – How to Create STAC Catalog File for S3 Bucket

amazon s3amazon-web-servicesopen-data-cubestac

I have s3 private bucket which contains .tif files.
Now, I need to create STAC file like the following:

My goal is to index file (in Open Data Cube) with the stac-to-dc method.

How can I create this .json file?

Best Answer

Great question. The easiest way to do this is using RIO STAC, which was developed by the magnificent Vincent Sarago. I use it programmatically (from Python).

Make sure you enable the Projection extension, but other than that, that's all you need to do.

Here's some code that does it.

And example is this:


    item = create_stac_item(
        path_to_tif_file,
        id="this-can-be-any-string",
        with_proj=True,
        input_datetime=datetime(2021, 12, 25),
        properties={
            "odc:product": "not_required_but_useful_for_odc"
        },
    )
Related Question