ungarj / mapchete

Tile-based geodata processing using rasterio & Fiona
MIT License
195 stars 28 forks source link

provide STAC metadata for all generated products #211

Closed 8snit closed 3 years ago

8snit commented 5 years ago

see https://github.com/radiantearth/stac-spec

details like how to represent the generated pyramids in best way to be discussed

Scartography commented 5 years ago

Article to introduce STAC

STAC Validators:

ungarj commented 5 years ago

keep #153 in mind by adding custom metadata items for STAC in mapchete file

ungarj commented 5 years ago

Main issue is how to handle tile directories, i.e. potentially millions of files with predictable paths. Creating one asset per file does not scale and is probably also not intended by the STAC spec but it can be implemented quickly.

Short-term solution: one asset per file Long-term solution: one asset per tile directory

@8snit @Scartography any comments?

ungarj commented 3 years ago

Use structure required by GDAL 3.3: https://gdal.org/drivers/raster/stacta.html

To make this work with mapchete we have to

For the first point we can add the required metadata in the output section of a mapchete file:

output:
  path: testdata/tmp/example
  format: GTiff
  dtype: float32
  bands: 3
  stac:
    id: test_output  # optional
    properties:  # optional
      whatever: property
    eo:bands:  # optional for STAC extensions
      - name: B04
        common_name: red
      - name: B03
        common_name: green
      - name: B02
        common_name: blue
    links:  # optional
      - rel: parent
        href: /path/to/parent/catalog.json
      - rel: root
        href: /path/to/root/catalog.json

This would then add an .json file to the tile directory or next to the single file.

For the second point we need a CLI tool and additional options for existing tools to add and/or update STAC metadata:

# to add or update STAC json
$ mapchete stac <mapchete_file or tile_directory> --stac-item-id <some-id>

# to add STAC json while using convert; per default an existing stac json should be used
$ mapchete convert <input> <output> --stac-item-id <some-id>

The STAC item id should default to the tile directory path when using a tile directory and the file basename (without extension) when using a single file output.