stac-fastapi
stac-fastapi copied to clipboard
Simple search returns items onlly with properties.datetime field
Dear all.
I have already opened an issue in stac-fastapi-elasticsearch
repository and I will report it here as well. See issue.
Simple search http://localhost:8000/search?limit=10
returns items onlly with properties.datetime field
In particular in line https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/blob/987f0b924b45e3f63302758b6e63d38ba504964f/stac_fastapi/core/stac_fastapi/core/core.py#L593C12-L593C64
filter_kwargs = search_request.fields.filter_fields
filter_fields is equal to
{'exclude': {}, 'include': {'assets': Ellipsis, 'bbox': Ellipsis, 'collection': Ellipsis, 'geometry': Ellipsis, 'id': Ellipsis, 'links': Ellipsis, 'properties': {'datetime'}, 'stac_version': Ellipsis, 'type': Ellipsis}}
As a response i get the FeatureCollection
{
"type": "FeatureCollection",
"features": [ {
"type": "Feature",
"properties": {
"datetime": "2015-07-04T10:10:06.027000+00:00"
},
. . .
]
. . .
}
Shouldnt the filter_kwargs` be equal to
{'exclude': {}, 'include': {'assets': Ellipsis, 'bbox': Ellipsis, 'collection': Ellipsis, 'geometry': Ellipsis, 'id': Ellipsis, 'links': Ellipsis, 'properties': Ellipsis, 'stac_version': Ellipsis, 'type': Ellipsis}}
FYI. The item has the following properties
"properties": {
"sat:relative_orbit": 22,
"start_datetime": "2015-07-04T10:10:06.027Z",
"end_datetime": "2015-07-04T10:10:06.027Z",
"processing:facility": "EPA_",
"title": "S2A_MSIL2A_20150704T101006_N0204_R022_T30NYK_20150704T102420.SAFE",
"platform": "Sentinel-2A",
"view:sun_elevation": 30.130819756471,
"datetime": "2015-07-04T10:10:06.027Z",
"instruments": [],
"constellation": "sentinel-2",
"sat:orbit_state": "descending",
"eo:cloud_cover": 84.456044,
"grid:code": "MGRS-30NYK",
"processing:level": "L2A",
"view:incidence_angle": 9.82920248878181,
"created": "2019-08-05T14:29:54Z",
"sentinel:product_id": "S2A_MSIL2A_20150704T101006_N0204_R022_T30NYK_20150704T102420",
"view:sun_azimuth": 49.058168068692,
"sentinel:datastrip_id": "S2A_USER_MSI_L2A_DS_EPA__20160808T224207_S20150704T102420_N02.04",
"sentinel:processing_baseline": "02.04",
"proj:bbox": [],
"proj:epsg": 32630,
"bdap:additional_attributes": {},
"processed": "2019-08-05T14:53:58.579614Z",
"mission": "Sentinel-2",
"view:azimuth": 100.76592332834346,
"gsd": 10,
"sat:absolute_orbit": 162,
"sentinel:acquisition_station": "EPA_"
}
Addendum:
I think it would be best to follow the STAC API specs https://api.stacspec.org/v1.0.0/item-search/
.
There are also implementations like STAC Browser that use the search endpoint in order to return items. As a user I would expect to see all the properties of an Item and filter them only if needed.
@vincentsarago What do you think?
I haven't encountered this in the past so I'll need to have a deeper look
👋 sorry for letting this stale a bit.
I think I have a bit more understanding of what's going on. I believe this is by design
and can easily be overridden by users when setting the Fields
Extension in their own application.
Explicitly get a valid STAC Item Because implementations may choose to always include other fields (e.g., extension-specific fields such as sar), this could has the same effect as an empty object for fields.
ref: https://github.com/stac-api-extensions/fields?tab=readme-ov-file#explicitly-get-a-valid-stac-item
I think stac-fastapi default cannot please all the user but at least it enable as much customization as possible.
ext = [
FieldsExtension(
default_includes={
"id",
"type",
"stac_version",
"geometry",
"bbox",
"links",
"assets",
"properties",
"collection",
}
)
]
api = StacApi(
...
extensions=ext,
...
)
should be resolved now