Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Extend create_stac, include include fiboa data
- Fix to vecorel: converter.license and provider should be string
- Added a Dockerfile to simplify working with fiboa
- Command `fiboa publish` to automate source coop publication process
Expand Down
21 changes: 21 additions & 0 deletions fiboa_cli/create_stac.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import click
from geopandas import GeoDataFrame
from vecorel_cli.cli.options import JSON_INDENT, VECOREL_FILE_ARG, VECOREL_TARGET_CONSOLE
from vecorel_cli.create_stac import CreateStacCollection
from vecorel_cli.registry import VecorelRegistry
from vecorel_cli.vecorel.collection import Collection

from fiboa_cli.fiboa.version import get_versions


class CreateFiboaStacCollection(CreateStacCollection):
Expand All @@ -24,3 +29,19 @@ def get_cli_args():
# todo: allow additional parameters for missing data in the collection?
# https://stackoverflow.com/questions/36513706/python-click-pass-unspecified-number-of-kwargs
}

def create(self, collection: Collection, gdf: GeoDataFrame, *args, **kwargs) -> dict:
data = super().create(collection, gdf, *args, **kwargs)
vecorel = VecorelRegistry()
data["assets"]["data"]["processing:software"].setdefault(
vecorel.name, vecorel.get_version()
)
schemas = collection.get_schemas()
vecorel_version, _, fiboa_version, _, extensions = get_versions(
next(iter(schemas.values()))
)
data["fiboa_version"] = fiboa_version
data.setdefault("vecorel_version", vecorel_version)
data.setdefault("vecorel_extensions", {k: list(v) for k, v in schemas.items()})

return data
4 changes: 2 additions & 2 deletions fiboa_cli/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from vecorel_cli.cli.options import VECOREL_TARGET
from vecorel_cli.convert import ConvertData
from vecorel_cli.converters import Converters
from vecorel_cli.create_stac import CreateStacCollection
from vecorel_cli.encoding.auto import create_encoding
from vecorel_cli.validate import ValidateData

from .create_stac import CreateFiboaStacCollection
from .registry import Registry

STAC_EXTENSION = "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json"
Expand Down Expand Up @@ -322,7 +322,7 @@ def create_stac_collection(self, target, file_name, parquet_file, stac_file):

self.success(f"Creating STAC collection.json for {parquet_file}")
p_stac.parent.mkdir(exist_ok=True)
CreateStacCollection().create_cli(parquet_file, stac_file)
CreateFiboaStacCollection().create_cli(parquet_file, stac_file)

Path(target, "stac").mkdir(parents=True, exist_ok=True)
data = json.load(open(stac_file, "r"))
Expand Down
2 changes: 1 addition & 1 deletion tests/data-files/stac-collection.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"stac_version": "1.1.0",
"stac_extensions": [
"https://stac-extensions.github.io/processing/v1.1.0/schema.json"
"https://stac-extensions.github.io/processing/v1.2.0/schema.json"
],
"type": "Collection",
"id": "de_nrw",
Expand Down
Loading