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

Client.get_collection should call STAC endpoint #114

Closed
geospatial-jeff opened this issue Oct 19, 2021 · 1 comment · Fixed by #121
Closed

Client.get_collection should call STAC endpoint #114

geospatial-jeff opened this issue Oct 19, 2021 · 1 comment · Fixed by #121
Milestone

Comments

@geospatial-jeff
Copy link

I think the pystac_client.Client.get_collection method should contact the GET /collections/{collectionId} endpoint instead of iterating through the response of GET /collections. Its better for an API client to utilize the server where appropriate instead of doing something client-side, and the later runs into issues for APIs which have a lot of collections that aren't necessarily exposed through the first call to GET /collections.

@matthewhanson matthewhanson added this to the 0.4.0 milestone Oct 27, 2021
@matthewhanson
Copy link
Member

@geospatial-jeff totally agree with this, the iteration seems unnecessary.

Just thinking this through....pystac-client works with both static catalogs and APIs. get_collection currently calls get_collections. In the case of an API it will call /collections. In the case of a static catalogs it will look at just the immediate children and find the right one. In a static catalog also, the link is not necessarily the collection ID so it has to be iterated through.

I think the right answer here is that get_collection should also check for conformance, and if this is an API that supports the /collections endpoint then it should use /collections/<cid>, otherwise resort to iterating through.

Will try and get this into the next minor release which should be in the next day.

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

Successfully merging a pull request may close this issue.

2 participants