Closed wildintellect closed 7 months ago
I can't reproduce. The notebook works fine for me on vedahub with the latest pangeo image. I looked at the docs though and it does seem like the response can potentially be either a feature or a feature collection https://staging-raster.delta-backend.com/docs#/Cloud%20Optimized%20GeoTIFF/geojson_statistics_cog_statistics_post
I guess we could genearalize that function to expect either, but it seems like the API should guarantee the schema of the response.
let's pass this over to the Data Service team to review then. cc @smohiudd @anayeaye
So is the issue here that (I've just read this issue and the notebook and haven't tried to test this yet):
Feature in = Feature out If you request cog/statistics with a feature collection you get a response that is a feature collection of the stats in each feature's properties.
Feature Collection in = Feature Collection out And if you request cog/statistics with a single feature then you get a response that is a single feature including stats in that feature's properties.
So we need to
OR are we saying that one API should always return the same format, i.e. you request with a single Feature or Feature Collection, we always return a Feature Collection?
That's a nice summary. This was my intent:
are we saying that one API should always return the same format, i.e. you request with a single Feature or Feature Collection, we always return a Feature Collection?
But that is really a question for titiler. Normally I expect APIs to return a consistent type. But I guess as long as the input matches the output that is a reasonable pattern too. I guess I'd want to make sure that if I pass a feature collection with just one feature I still get a feature collection out. If that is the case then I can be happy.
@zacharyDez @vincentsarago have opinions on this?
You should always get the same thing that you passed
Feature (in) -> Feature (out) FeatureCollection (in) -> FeatureCollection (out)
https://github.com/developmentseed/titiler/blob/main/src/titiler/core/titiler/core/factory.py#L488-L492 https://github.com/developmentseed/titiler/blob/main/src/titiler/core/titiler/core/factory.py#L525
If not, there is a bug!
This is tested here https://github.com/developmentseed/titiler/blob/main/src/titiler/core/tests/test_factories.py#L549-L603
Ok. So we can't reproduce the original issue and it seems like titiler is working as expected. So it's just a documentation problem.
Close when the PR is merged https://github.com/NASA-IMPACT/veda-docs/pull/133
@freitagb reported there's an issue in https://nasa-impact.github.io/veda-docs/notebooks/datasets/ocean-npp-timeseries-analysis.html#the-case-study---walvis-bay-namibia