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

Do not include a BoundingBox tag in GetFeatureInfo responses, when it is null #54858

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

strk
Copy link
Contributor

@strk strk commented Oct 5, 2023

I've noticed QGIS WMS responses are including a BoundingBox tag with min/max values being all 0.0 when the real bounding box is null, this PR aims at making it more explicit to allow for using other encoding for a null bounding box.

I haven't found the specification of the returned XML to see if a more formal way to express a null bounding box exists.

References #54646 (comment)

\cc @elpaso

@strk strk added the Server Related to QGIS server label Oct 5, 2023
@github-actions github-actions bot added this to the 3.34.0 milestone Oct 5, 2023
@strk strk changed the title Do not include a BoundingBox tag in WMS responses, when it is null Do not include a BoundingBox tag in GetFeatureInfo responses, when it is null Oct 5, 2023
@elpaso
Copy link
Contributor

elpaso commented Oct 5, 2023

To be honest I couldn't find the specifications about the GetFeatureInfo XML response so I don't know if the bbox is mandatory or if it is expected by clients even if it's null.

@pblottiere @rldhont @rouault do you have any clue?

@strk
Copy link
Contributor Author

strk commented Oct 5, 2023

I've read on stackoverflow that OGC does not mandate any format for the response of a GetFeatureInfo call. Indeed GeoServer seem to be responding with HTML or JSON and allows customization so I guess QGIS can decide on a format. Ideally such format would then be documented by QGIS itself. In the test I've modified there's no geometrical component at all in the response so I'm not even sure that's a valid thing, but in any case a BoundingBox makes no sense in it so I'd think it's ok to omit that.

@strk
Copy link
Contributor Author

strk commented Oct 5, 2023

The page I was reading about not mandating a format was: https://gis.stackexchange.com/questions/57733/in-what-format-does-a-wms-getfeatureinfo-return-data

@elpaso
Copy link
Contributor

elpaso commented Oct 5, 2023

I've read on stackoverflow that OGC does not mandate any format for the response of a GetFeatureInfo call. Indeed GeoServer seem to be responding with HTML or JSON and allows customization so I guess QGIS can decide on a format. Ideally such format would then be documented by QGIS itself. In the test I've modified there's no geometrical component at all in the response so I'm not even sure that's a valid thing, but in any case a BoundingBox makes no sense in it so I'd think it's ok to omit that.

It would make sense if the client checks the bbox to know that it's an aspatial table (which is supported). The response may have no features so it's not always possible to check if the features have a geometry.

I guess you should check what GeoServer does in this situation, AFAIK it is a reference implementation.

@jodygarnett
Copy link

If there is not a spatial table, how can someone click on the feature in a WMS GetFeatureInfo request?

@strk
Copy link
Contributor Author

strk commented Oct 5, 2023

The test making the request is here:
https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsserver_wms_getfeatureinfo_postgres.py#L156

There is no spatial query either, is "universe bounding box" to be assumed when that happens ?

@elpaso
Copy link
Contributor

elpaso commented Oct 5, 2023

If there is not a spatial table, how can someone click on the feature in a WMS GetFeatureInfo request?

It is meant for API calls using FILTER https://docs.qgis.org/3.28/en/docs/server_manual/services/wms.html#getfeatureinfo

@strk
Copy link
Contributor Author

strk commented Oct 6, 2023

I'm getting a fiailure in assertXMLEqual but the failure doesn't tell me what the actual result is: https://github.com/qgis/QGIS/actions/runs/6420951207/job/17441540938?pr=54858#step:13:639 should we always show the diff instead ?

Looking at the expected xml, there's an empty "extent" tag, maybe we want to completely avoid expecting that line ? Lack of that line in the current response sounds like a likely consequence of not including null rects.

@strk
Copy link
Contributor Author

strk commented Oct 6, 2023

Uhm, that test does something different than I thought, and I'm not sure what, exactly.
Even if I leave a single line in the tests/testdata/qgis_server/test_project_postgres_types.qgs file, the test complains about a completely different number of expected/obtained lines so I'm not sure what lines it's talking about

@strk
Copy link
Contributor Author

strk commented Oct 6, 2023

Got it: it's the get_postgres_types_json_dict.txt to be changed

@strk strk force-pushed the GetFeatureInfoResponse branch from 9fa7d4a to dc5d079 Compare October 6, 2023 08:49
@strk
Copy link
Contributor Author

strk commented Oct 6, 2023

Testsuite seem now happy. I need this change in order to change the internal representation of a NULL QGsRectangle - see GH-54646 - just printing those BoundingBox elements with arbitrary data makes no sense anyway.

Copy link
Contributor

@lnicola lnicola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a cursory reading of the spec, the contents of GetFeatureInfoResponse seems to be left to the latitude of the server, so I guess this looks fine.

@strk
Copy link
Contributor Author

strk commented Oct 6, 2023

Unfortunately your approval is not enough for me to be allowed to merge this in. Hopefully @elpaso @pblottiere @rldhont @rouault will allow this in to help move on with the other PR about QgsRectangle ( GH-54646 )

@nyalldawson nyalldawson merged commit 54094b6 into qgis:master Oct 6, 2023
@strk strk deleted the GetFeatureInfoResponse branch October 7, 2023 23:26
@nmtoken
Copy link

nmtoken commented Jan 16, 2025

A BoundingBox is required by WMS GetFeatureInfo. It tells the WMS server which bounding box was used to create the image for which the pixel coordinate (point clicked in the map image) applies. WMS server requests are stateless, the server doesn't hold session state to know which map image has been clicked on to provide the feature request, instead the feature request must send the full information to create the image, plus additional parameters to say which pixel is queried and which format you want the feature information to be returned in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Server Related to QGIS server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants