Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix items STAC datetime (#980) #981

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix items STAC datetime (#980)
  • Loading branch information
tomkralidis committed Jun 20, 2024
commit 78a18d86a414057f147bc5e3227be69587590f69
7 changes: 7 additions & 0 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,13 @@ def record2json(record, url, collection, mode='ogcapi-records'):
else:
record_dict['time'] = record.time_begin

if mode == 'stac-api':
if record.time_begin is not None or record.time_end is not None:
kalxas marked this conversation as resolved.
Show resolved Hide resolved
record_dict['properties']['start_datetime'] = record.begin_time
record_dict['properties']['end_datetime'] = record.end_time
else:
record_dict['properties']['datetime'] = record.time

return record_dict


Expand Down
4 changes: 2 additions & 2 deletions pycsw/stac/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ def links2stacassets(collection, record):
if 'collection' not in record:
record['collection'] = collection

links_assets = [i for i in record['links'] if i['rel'] == 'enclosure']
links_to_keep = [i for i in record['links'] if i['rel'] != 'enclosure']
links_assets = [i for i in record['links'] if i.get('rel', '') == 'enclosure']
links_to_keep = [i for i in record['links'] if i.get('rel', '') != 'enclosure']

record['links'] = links_to_keep

Expand Down
Loading