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

Unable to get "next page of results" when searching STAC features #2175

Open
bertcoerver opened this issue Sep 20, 2024 · 0 comments
Open

Unable to get "next page of results" when searching STAC features #2175

bertcoerver opened this issue Sep 20, 2024 · 0 comments

Comments

@bertcoerver
Copy link

Hello,

I'm trying to do a search on https://cmr.earthdata.nasa.gov/stac/LAADS/search (using Python). My code was working until a few weeks ago, but now I'm not able to retrieve all results when the number of items returned exceeds limit. Here is an example:

import requests

url = 'https://cmr.earthdata.nasa.gov/stac/LAADS/search'

params = {
    'limit': 250,
    'bbox': [
                36.42191632061822,
                32.24152077745001,
                36.56950917300816,
                32.37621048001086
            ],
    'datetime': '2023-03-01T00:00:00Z/2023-09-30T23:59:59Z',
    'collections': ['VNP03IMG.v2']
 }

resp = requests.post(url, json = params)
resp.raise_for_status()

output_01 = resp.json()

next_page = [x for x in output_01["links"] if x["rel"] == "next"][0]

print(len(output_01["features"]))
print(next_page["title"])
print(next_page["href"])

>>> 250
>>> Next page of results
>>> https://cmr.earthdata.nasa.gov/stac/LAADS/search?limit=250&bbox=36.42191632061822%2C32.24152077745001%2C36.56950917300816%2C32.37621048001086&datetime=2023-03-01T00%3A00%3A00Z%2F2023-09-30T23%3A59%3A59Z&collections=VNP03IMG.v2&cursor=eyJqc29uIjoiW1wibGFhZHNcIiwxNjg1NzUxODQwMDAwLDI3MDI2NjQ3NDFdIiwidW1tIjoiW1wibGFhZHNcIiwxNjg1NzUxODQwMDAwLDI3MDI2NjQ3NDFdIn0%3D

So far all is good, I've got 250 features, but now I need to request the next page. Both methods below (using either GET or POST) give me a 500 response:

resp = requests.get(next_page["href"])
resp.raise_for_status()
resp = requests.post(next_page["href"], json = params)
resp.raise_for_status()

Any advice on how to continue?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant