Skip to content

Add ability to enable pgstac.update_collection_extent in database bootstrapper #239

Description

@hrodmn

It would be nice to be able to enable pgstac's "update collection extent using items" feature here:

def customization(cursor, params) -> None:
"""
CUSTOMIZED YOUR PGSTAC DATABASE
ref: https://github.com/stac-utils/pgstac/blob/main/docs/src/pgstac.md
"""
if str(params.get("context", "FALSE")).upper() == "TRUE":
# Add CONTEXT=ON
pgstac_settings = """
INSERT INTO pgstac_settings (name, value)
VALUES ('context', 'on')
ON CONFLICT ON CONSTRAINT pgstac_settings_pkey DO UPDATE SET value = excluded.value;"""
cursor.execute(sql.SQL(pgstac_settings))
if str(params.get("mosaic_index", "TRUE")).upper() == "TRUE":
# Create index of searches with `mosaic`` type
cursor.execute(
sql.SQL(
"CREATE INDEX IF NOT EXISTS searches_mosaic ON searches ((true)) WHERE metadata->>'type'='mosaic';"
)
)

Relevant pgstac docs: https://github.com/stac-utils/pgstac/blob/main/docs/src/pypgstac.md#automated-collection-extent-updates

cc @bitnerd

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions