Skip to content

NHGF STAC collections fail to by read in with pystac

I am trying to use pystac to read in the collections from the NHGF STAC on pygeoapi. I can create a catalog object, but the code errors out with I try to run .get_collections() from the catalog. I believe this has to do with the 'href' tag on each collection item, since the error message I receive includes a URL with duplicated text in it. image

When I use Insomnia to make a GET request to the NHGF STAC (https://labs-beta.waterdata.usgs.gov/api/gdp/pygeoapi/stac/nhgf-stac-collection), I notice that the 'href' tags include the same duplicated text. I am thinking this could be causing pystac to generate the wrong url when it is trying to access the individual collections. image

Here is my code to duplicate the error:

import pystac

catalog_url = "https://labs-beta.waterdata.usgs.gov/api/gdp/pygeoapi/stac/nhgf-stac-collection/?f=json"
catalog = pystac.Catalog.from_file(catalog_url)
collections = list(catalog.get_collections())
Edited by Hopkins, Anders L