pgstac
pgstac copied to clipboard
Feature request: Update collection extend from item(s)
It would be nice if there was an easy way to update the collection extend.
I can imagine the following ways:
- A new command in
pypgstac
that does the update based on the collection's items datetime and geometry in the database. - A flag in
pypgstac items load
that would update the collection extend based on the datetime and geometry of the new item.
If you think that it would be useful feature I can try making a PR.
@charalamm there is a configuration option, that looking now, it doesn't look like we ever added to the documentation (I am ALWAYS open to any PR to help make our docs better!)
Setting pgstac.update_collection_extent='true' will use a trigger to automatically update the spatial and temporal extent in any collections when items are added. This trigger can add a fair amount of overhead to any data load transactions, using this along with the pgstac.use_queue setting (which then requires a cron of some sort ie with the pg_cron postgres extension to make sure that CALL run_queued_queries();
gets run in the background periodically) can help mitigate this by running the updates to the collection extent in the background rather than within the same transaction as the data load.
Nice that you have implemented it already. Thanks! I will send a documentation PR asap