Point selections - how to write correct query?
Apollo3zehn opened this issue · 4 comments
I am trying to read data from HSDS with a point selection query parameter. For example, I would like to query the points
[
[2, 4],
[1, 3],
[9, 9]
]
How would I do that? My current approach looks like this but it fails:
http://hsdshdflab.hdfgroup.org/datasets/d-d38053ea-3418fe27-22d9-478e7b-913279/value?domain=/shared/tall.h5&select=[[2, 1, 9],[4, 3, 9]]
What works is a syntax like ...&select=[0:3,[3,4,7]]
, but with that I cannot freely choose the points to be selected.
Strangely, the syntax ...&select=[[1, 2, 3],[4, 5, 6]]
returns HTTP Status 200 OK, but no json data:
Any hint would be appreciated. Thanks :-)
Hi @Apollo3zehn, referring to https://github.com/HDFGroup/hdf-rest-api/blob/master/DatasetOps/GET_Value.rst, that format is specifically used for retrieving values from a dataset using a hyperslab selection. If you want to retrieve values using a point selection, you should make a POST request to the dataset with the request body containing the point selection desired. See https://github.com/HDFGroup/hdf-rest-api/blob/master/DatasetOps/POST_Value.md for a description of what the request should look like.
Thank you! Unfortunately this does not seem to work (or I am using it wrong):
❯ curl -X POST 'http://hsdshdflab.hdfgroup.org/datasets/d-d38053ea-3418fe27-22d9-478e7b-913279/value?domain=/shared/tall.h5' \
-H 'Content-Type: application/json' \
-d '{ "points": [2, 4, 1, 3, 9, 9] }'
500 Internal Server Error
Server got itself in trouble
Based on your first post, am I correct in assuming that your dataset has two dimensions? If so, I think your request body would instead look like:
{ "points": [[2, 4], [1, 3], [9, 9]] }
Thank you, its working now!