CMR STAC GET requests are broken
Posted: Tue Sep 24, 2024 8:08 am America/New_York
I believe this is the underlying cause of STAC-related issues that users are having in recent weeks:
https://forum.earthdata.nasa.gov/viewtopic.php?t=5953
https://forum.earthdata.nasa.gov/viewtopic.php?t=5922
POST requests to the /search endpoint are working properly, but GET requests are returning empty results when they clearly should be returning items in an ItemCollection.
For example, here is a request for some HLS items that returns the specified number of items (1) in an item collection:
[code]
!curl -X POST \
-H "Content-Type: application/json" \
-d '{ \
"bbox": [-105.55, 35.64, -105.31, 35.81], \
"datetime": "2024-01-01T00:00:00Z/2024-09-01T00:00:00Z", \
"collections": ["HLSL30_2.0", "HLSS30_2.0"],\
"limit": 1 \
}' \
https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search | jq
[!code]
Results (abbreviated):
[code]
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "HLS.S30.T13SDV.2024003T174731.v2.0",
"stac_version": "1.0.0",
"stac_extensions": [
"https://stac-extensions.github.io/eo/v1.0.0/schema.json"
],
"properties": {
"datetime": "2024-01-03T17:54:08.034Z",
"eo:cloud_cover": 45,
"start_datetime": "2024-01-03T17:54:08.034Z",
"end_datetime": "2024-01-03T17:54:08.034Z"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-106.0982929,
35.1499121
],
[
-104.8928408,
35.1548427
],
[
-104.8915104,
36.1448493
],
[
-106.1119251,
36.1397366
],
[
-106.0982929,
35.1499121
]
]
]
},
"bbox": [
-106.1119251,
35.1499121,
-104.8915104,
36.1448493
],
"assets": {
...
}
},
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/items/HLS.S30.T13SDV.2024003T174731.v2.0",
"type": "application/geo+json"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/",
"type": "application/geo+json"
},
{
"rel": "collection",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/",
"type": "application/geo+json"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json"
},
{
"rel": "provider",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json"
},
{
"rel": "via",
"href": "https://cmr.earthdata.nasa.gov/search/concepts/G2832232406-LPCLOUD.json",
"title": "CMR JSON metadata for item",
"type": "application/json"
},
{
"rel": "via",
"href": "https://cmr.earthdata.nasa.gov/search/concepts/G2832232406-LPCLOUD.umm_json",
"title": "CMR UMM_JSON metadata for item",
"type": "application/vnd.nasa.cmr.umm+json"
}
],
"collection": "HLSS30_2.0"
}
],
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search",
"type": "application/geo+json",
"title": "This search"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json",
"title": "Root Catalog"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json",
"title": "Provider Catalog"
},
{
"rel": "first",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1",
"type": "application/geo+json",
"title": "First page of results"
},
{
"rel": "next",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9",
"type": "application/geo+json",
"title": "Next page of results"
}
],
"context": {
"returned": 1,
"limit": 1,
"matched": 77
}
}
]
[/code]
If a client tries to use the link to the next page of results ("rel": "next"), it returns an empty ItemCollection when it should clearly return at least one result:
[code]
!curl -X GET "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9" | jq
[\code]
Result:
[code]
{
"type": "FeatureCollection",
"features": [],
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&collections=HLSL30_2.0%2CHLSS30_2.0&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&limit=1",
"type": "application/geo+json",
"title": "This search"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json",
"title": "Root Catalog"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json",
"title": "Provider Catalog"
},
{
"rel": "first",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&collections=HLSL30_2.0%2CHLSS30_2.0&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&limit=1",
"type": "application/geo+json",
"title": "First page of results"
}
],
"context": {
"returned": 0,
"limit": 1,
"matched": 0
}
}
[\code]
Most STAC client applications use the paged result link structure to iterate through search results, which is why many users are experiencing issues when running searches that should return more than the default limit (20).
https://forum.earthdata.nasa.gov/viewtopic.php?t=5953
https://forum.earthdata.nasa.gov/viewtopic.php?t=5922
POST requests to the /search endpoint are working properly, but GET requests are returning empty results when they clearly should be returning items in an ItemCollection.
For example, here is a request for some HLS items that returns the specified number of items (1) in an item collection:
[code]
!curl -X POST \
-H "Content-Type: application/json" \
-d '{ \
"bbox": [-105.55, 35.64, -105.31, 35.81], \
"datetime": "2024-01-01T00:00:00Z/2024-09-01T00:00:00Z", \
"collections": ["HLSL30_2.0", "HLSS30_2.0"],\
"limit": 1 \
}' \
https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search | jq
[!code]
Results (abbreviated):
[code]
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "HLS.S30.T13SDV.2024003T174731.v2.0",
"stac_version": "1.0.0",
"stac_extensions": [
"https://stac-extensions.github.io/eo/v1.0.0/schema.json"
],
"properties": {
"datetime": "2024-01-03T17:54:08.034Z",
"eo:cloud_cover": 45,
"start_datetime": "2024-01-03T17:54:08.034Z",
"end_datetime": "2024-01-03T17:54:08.034Z"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-106.0982929,
35.1499121
],
[
-104.8928408,
35.1548427
],
[
-104.8915104,
36.1448493
],
[
-106.1119251,
36.1397366
],
[
-106.0982929,
35.1499121
]
]
]
},
"bbox": [
-106.1119251,
35.1499121,
-104.8915104,
36.1448493
],
"assets": {
...
}
},
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/items/HLS.S30.T13SDV.2024003T174731.v2.0",
"type": "application/geo+json"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/",
"type": "application/geo+json"
},
{
"rel": "collection",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/collections/HLSS30_2.0/",
"type": "application/geo+json"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json"
},
{
"rel": "provider",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json"
},
{
"rel": "via",
"href": "https://cmr.earthdata.nasa.gov/search/concepts/G2832232406-LPCLOUD.json",
"title": "CMR JSON metadata for item",
"type": "application/json"
},
{
"rel": "via",
"href": "https://cmr.earthdata.nasa.gov/search/concepts/G2832232406-LPCLOUD.umm_json",
"title": "CMR UMM_JSON metadata for item",
"type": "application/vnd.nasa.cmr.umm+json"
}
],
"collection": "HLSS30_2.0"
}
],
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search",
"type": "application/geo+json",
"title": "This search"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json",
"title": "Root Catalog"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json",
"title": "Provider Catalog"
},
{
"rel": "first",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1",
"type": "application/geo+json",
"title": "First page of results"
},
{
"rel": "next",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9",
"type": "application/geo+json",
"title": "Next page of results"
}
],
"context": {
"returned": 1,
"limit": 1,
"matched": 77
}
}
]
[/code]
If a client tries to use the link to the next page of results ("rel": "next"), it returns an empty ItemCollection when it should clearly return at least one result:
[code]
!curl -X GET "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9" | jq
[\code]
Result:
[code]
{
"type": "FeatureCollection",
"features": [],
"links": [
{
"rel": "self",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&collections=HLSL30_2.0%2CHLSS30_2.0&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&limit=1",
"type": "application/geo+json",
"title": "This search"
},
{
"rel": "root",
"href": "https://cmr.earthdata.nasa.gov/stac",
"type": "application/json",
"title": "Root Catalog"
},
{
"rel": "parent",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD",
"type": "application/json",
"title": "Provider Catalog"
},
{
"rel": "first",
"href": "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&collections=HLSL30_2.0%2CHLSS30_2.0&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&limit=1",
"type": "application/geo+json",
"title": "First page of results"
}
],
"context": {
"returned": 0,
"limit": 1,
"matched": 0
}
}
[\code]
Most STAC client applications use the paged result link structure to iterate through search results, which is why many users are experiencing issues when running searches that should return more than the default limit (20).