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

[sensorthings] follow navigationlinks and add links to attribute table #56805

Closed
pvgenuchten opened this issue Mar 11, 2024 · 4 comments · Fixed by #56960
Closed

[sensorthings] follow navigationlinks and add links to attribute table #56805

pvgenuchten opened this issue Mar 11, 2024 · 4 comments · Fixed by #56960

Comments

@pvgenuchten
Copy link

pvgenuchten commented Mar 11, 2024

Feature description

Sensorthings adds to each type (sensor, location, datastream) a set of navigationlinks which enable linkage between the types, actually one needs to follow the link to retrieve the actual identifier of the linked entity, or use the $expand option on the query to expand the basic query with additional types.

https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams?$expand=Observations&$top=10

Qgis currently does not include these navigation links in the attribute table, which makes it hard to link datastreams to their related location and observations

Some samples:

https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Sensors(15424)

{
    "@iot.selfLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Sensors(15424)",
...
    "Datastreams@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Sensors(15424)/Datastreams",
    "MultiDatastreams@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Sensors(15424)/MultiDatastreams"
}

https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)

{
    "@iot.selfLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)",
...
    "ObservedProperty@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)/ObservedProperty",
    "Sensor@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)/Sensor",
    "Thing@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)/Thing",
    "Observations@iot.navigationLink": "https://airquality-frost.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Datastreams(19801)/Observations"
}

image

Suggestion would be to include the navigationlinks as column(s) to the attribute table, either as a json string like the properties snippet, or as an array by link type

Additional context

Sensorthings spec

This would enable me to add locations, things, datastreams and observations to my project and link them using joins, location has the coordinates, observations contains the actual measured values. I can even use the (latest) value in observation to style the icon of the location.

@pvgenuchten pvgenuchten changed the title [sensorthings] add navigationlinks to attribute table [sensorthings] follow navigationlinks and add links to attribute table Mar 11, 2024
@pvgenuchten
Copy link
Author

Other option here would be to enable a multiselect on the Entity type in the sensorthings data source manager

image

QGIS would $expand the query with the selected entity types (which would be the main type?)

The result would be a hierarchical object of the main type and its children, is QGIS able to visualise such a data structure in the attribute table?

The logic behind user selection of main and subtypes is that every sensorthings API is different, some have a focus on feature-of-interest, some on location.

In order to prevent loading the full database it is important to limit the result by filters, or else a max number ($top). Providing user friendly filter options may be challenging, because filters may apply at any level (observation/result > 0, location/geometry within map bounds, observedProperty/name = 'FE')

@nyalldawson
Copy link
Collaborator

@pvgenuchten this is on it's way for 3.38 👍

@pvgenuchten
Copy link
Author

Nice! Always available to test/share thoughts..

@sgrellet
Copy link

Thanks Paul for testing and providing this idea, feel free to add some more and spread the word :)

nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Mar 25, 2024
This change allows SensorThings entities to be expanded to contain
their related child feature attributes, exposing the relational
SensorThings model as a traditional "flat" GIS-friendly table
structure.

Eg when selecting Location entities, you can now opt to expand
to "Things > Datastreams > Observations". This would result in
multiple "stacked" point location features, one corresponding
to each observation, with the attributes for each point feature
containing the location, thing, datastream and observation
attributes.

(Best used combined with some extent, feature limit, or custom
filter option, as this can otherwise result in very heavy
requests to the backend service!)

Fixes qgis#56805
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Mar 25, 2024
This change allows SensorThings entities to be expanded to contain
their related child feature attributes, exposing the relational
SensorThings model as a traditional "flat" GIS-friendly table
structure.

Eg when selecting Location entities, you can now opt to expand
to "Things > Datastreams > Observations". This would result in
multiple "stacked" point location features, one corresponding
to each observation, with the attributes for each point feature
containing the location, thing, datastream and observation
attributes.

(Best used combined with some extent, feature limit, or custom
filter option, as this can otherwise result in very heavy
requests to the backend service!)

Fixes qgis#56805
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue May 16, 2024
This change allows SensorThings entities to be expanded to contain
their related child feature attributes, exposing the relational
SensorThings model as a traditional "flat" GIS-friendly table
structure.

Eg when selecting Location entities, you can now opt to expand
to "Things > Datastreams > Observations". This would result in
multiple "stacked" point location features, one corresponding
to each observation, with the attributes for each point feature
containing the location, thing, datastream and observation
attributes.

(Best used combined with some extent, feature limit, or custom
filter option, as this can otherwise result in very heavy
requests to the backend service!)

Fixes qgis#56805
nyalldawson added a commit that referenced this issue May 16, 2024
This change allows SensorThings entities to be expanded to contain
their related child feature attributes, exposing the relational
SensorThings model as a traditional "flat" GIS-friendly table
structure.

Eg when selecting Location entities, you can now opt to expand
to "Things > Datastreams > Observations". This would result in
multiple "stacked" point location features, one corresponding
to each observation, with the attributes for each point feature
containing the location, thing, datastream and observation
attributes.

(Best used combined with some extent, feature limit, or custom
filter option, as this can otherwise result in very heavy
requests to the backend service!)

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

Successfully merging a pull request may close this issue.

3 participants