diff --git a/pycsw/core/metadata.py b/pycsw/core/metadata.py index 12f88cb97..7d92cb994 100644 --- a/pycsw/core/metadata.py +++ b/pycsw/core/metadata.py @@ -1834,6 +1834,7 @@ def _parse_stac_resource(context, repos, record): _set(context, recobj, 'pycsw:CreationDate', record['properties'].get('created')) _set(context, recobj, 'pycsw:Modified', record['properties'].get('updated')) _set(context, recobj, 'pycsw:Platform', record['properties'].get('platform')) + _set(context, recobj, 'pycsw:OtherConstraints', record['properties'].get('license')) instruments = record['properties'].get('instruments') if instruments is not None: _set(context, recobj, 'pycsw:Instrument', ','.join(instruments)) @@ -1853,6 +1854,7 @@ def _parse_stac_resource(context, repos, record): _set(context, recobj, 'pycsw:CreationDate', record.get('created')) _set(context, recobj, 'pycsw:Modified', record.get('updated')) _set(context, recobj, 'pycsw:Platform', record.get('platform')) + _set(context, recobj, 'pycsw:OtherConstraints', record.get('license')) instruments = record.get('instruments') if instruments is not None: _set(context, recobj, 'pycsw:Instrument', ','.join(instruments)) @@ -1876,6 +1878,7 @@ def _parse_stac_resource(context, repos, record): _set(context, recobj, 'pycsw:CreationDate', record.get('created')) _set(context, recobj, 'pycsw:Modified', record.get('updated')) _set(context, recobj, 'pycsw:Platform', record.get('platform')) + _set(context, recobj, 'pycsw:OtherConstraints', record.get('license')) instruments = record.get('instruments') if instruments is not None: _set(context, recobj, 'pycsw:Instrument', ','.join(instruments)) diff --git a/pycsw/core/repository.py b/pycsw/core/repository.py index ec9d209c3..d0d599f7f 100644 --- a/pycsw/core/repository.py +++ b/pycsw/core/repository.py @@ -169,7 +169,8 @@ def __init__(self, database, context, app_root=None, table='records', repo_filte 'instrument': self.dataset.instrument, 'sensortype': self.dataset.sensortype, 'off_nadir': self.dataset.illuminationelevationangle, - 'distancevalue': self.dataset.distancevalue + 'distancevalue': self.dataset.distancevalue, + 'otherconstraints': self.dataset.otherconstraints } if self.dbtype == 'postgresql': diff --git a/tests/functionaltests/suites/oarec/test_oarec_functional.py b/tests/functionaltests/suites/oarec/test_oarec_functional.py index a73cfd5a1..18fe60fd9 100644 --- a/tests/functionaltests/suites/oarec/test_oarec_functional.py +++ b/tests/functionaltests/suites/oarec/test_oarec_functional.py @@ -108,7 +108,7 @@ def test_queryables(config): assert content['$id'] == 'http://localhost/pycsw/oarec/collections/metadata:main/queryables' # noqa assert content['$schema'] == 'http://json-schema.org/draft/2019-09/schema' - assert len(content['properties']) == 18 + assert len(content['properties']) == 19 assert 'geometry' in content['properties'] assert content['properties']['geometry']['$ref'] == 'https://geojson.org/schema/Polygon.json' # noqa diff --git a/tests/functionaltests/suites/oarec/test_oarec_virtual_collections_functional.py b/tests/functionaltests/suites/oarec/test_oarec_virtual_collections_functional.py index 6b12fbb69..7f182ba69 100644 --- a/tests/functionaltests/suites/oarec/test_oarec_virtual_collections_functional.py +++ b/tests/functionaltests/suites/oarec/test_oarec_virtual_collections_functional.py @@ -116,7 +116,7 @@ def test_queryables(config_virtual_collections): assert content['$id'] == 'http://localhost/pycsw/oarec/collections/metadata:main/queryables' # noqa assert content['$schema'] == 'http://json-schema.org/draft/2019-09/schema' - assert len(content['properties']) == 18 + assert len(content['properties']) == 19 assert 'geometry' in content['properties'] assert content['properties']['geometry']['$ref'] == 'https://geojson.org/schema/Polygon.json' # noqa diff --git a/tests/functionaltests/suites/stac_api/data/S2A_MSIL2A_20241128T092331_R093_T34SEJ_20241128T122153.json b/tests/functionaltests/suites/stac_api/data/S2A_MSIL2A_20241128T092331_R093_T34SEJ_20241128T122153.json index d102d7992..e9ff50d97 100644 --- a/tests/functionaltests/suites/stac_api/data/S2A_MSIL2A_20241128T092331_R093_T34SEJ_20241128T122153.json +++ b/tests/functionaltests/suites/stac_api/data/S2A_MSIL2A_20241128T092331_R093_T34SEJ_20241128T122153.json @@ -689,6 +689,7 @@ }, "collection": "sentinel-2-l2a", "properties": { + "license": "other", "datetime": "2024-11-28T09:23:31.024000Z", "platform": "Sentinel-2A", "proj:epsg": 32634, @@ -730,4 +731,4 @@ "https://stac-extensions.github.io/projection/v1.0.0/schema.json" ], "stac_version": "1.0.0" -} \ No newline at end of file +} diff --git a/tests/functionaltests/suites/stac_api/data/records.db b/tests/functionaltests/suites/stac_api/data/records.db index 65afd89fa..a51882ce7 100644 Binary files a/tests/functionaltests/suites/stac_api/data/records.db and b/tests/functionaltests/suites/stac_api/data/records.db differ diff --git a/tests/functionaltests/suites/stac_api/test_stac_api_functional.py b/tests/functionaltests/suites/stac_api/test_stac_api_functional.py index 96b97b6e3..f8155f365 100644 --- a/tests/functionaltests/suites/stac_api/test_stac_api_functional.py +++ b/tests/functionaltests/suites/stac_api/test_stac_api_functional.py @@ -3,7 +3,7 @@ # Authors: Tom Kralidis # Angelos Tzotsos # -# Copyright (c) 2025 Tom Kralidis +# Copyright (c) 2026 Tom Kralidis # Copyright (c) 2022 Angelos Tzotsos # # Permission is hereby granted, free of charge, to any person @@ -134,7 +134,7 @@ def test_queryables(config): assert content['$id'] == 'http://localhost/pycsw/oarec/stac/collections/metadata:main/queryables' # noqa assert content['$schema'] == 'http://json-schema.org/draft/2019-09/schema' - assert len(content['properties']) == 18 + assert len(content['properties']) == 19 assert 'geometry' in content['properties'] assert content['properties']['geometry']['$ref'] == 'https://geojson.org/schema/Polygon.json' # noqa @@ -191,6 +191,11 @@ def test_items(config): assert content['numberMatched'] == 26 assert content['features'][6]['properties']['title'] == 'S2B_MSIL1C_20190910T095029_N0208_R079_T33UWQ_20190910T120910.SAFE' # noqa + content = json.loads(api.items({}, None, {'otherconstraints': 'other'})[2]) + + assert content['numberMatched'] == 1 + assert content['features'][0]['properties']['license'] == 'other' + content = json.loads(api.items({}, None, {'sortby': '-title'})[2]) assert content['numberMatched'] == 26