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

Highlight of geometry when using infoclick not working for QGIS Server #879

Closed
eri-blan opened this issue Oct 18, 2021 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@eri-blan
Copy link

eri-blan commented Oct 18, 2021

Describe the bug
When getting a GetFeatureInfo hit on a QGIS Server WMS-layer, the returned feature object/s does not contain any geometry information. Thus, no highlight of the object is shown on the map. The resulting null geometry/ies is likely due to the parameter WITH_GEOMETRY=TRUE not being sent with the request.

See Link to QGIS Server documentation concerning extra parameters

To Reproduce
Steps to reproduce the behavior:

  1. Activate a layer that comes from QGIS-server.
  2. Use the infoclick tool and click on an object on the map.
  3. See that no highlight is shown on the map.
  4. If one looks at the response from the server, it can be seen that the geometry is null.

Expected behavior
Highlight should be shown on the map of the selected object's geometry.

Desktop (please complete the following information):

Tested on

  • OS: Windows 10
  • Browser Chrome

But applicable to any environment.

Additional context
There is also a setting within the QGIS project called "Add geometry to feature response" that needs to be checked in order for the function to possibly work.

jacobwod added a commit that referenced this issue Oct 19, 2021
@jacobwod jacobwod self-assigned this Oct 19, 2021
@jacobwod jacobwod added the bug label Oct 19, 2021
@jacobwod jacobwod added this to the 3.8 milestone Oct 19, 2021
@jacobwod
Copy link
Member

The fix is ready for testing in develop. As you've mentioned, please ensure that you've enabled the Add geometry to feature response option in the QGIS project. https://docs.qgis.org/3.16/en/docs/server_manual/services.html#wms-withgeometry

@eri-blan
Copy link
Author

Great! I tested this out and it seems to work.
I noticed however that the layer projection has to be configured to be the same as the map's projection. If not, there seems be a mismatch and the highlight probably ends up somewhere other than supposed to (i.e. the projection of the layer is assumed to be the same as the map projection). Also, QGIS Server does not provide any projection information within the response, like geoserver seems to do.

@jacobwod
Copy link
Member

Thanks, you're absolutely right @eri-blan. I'm looking into this. We could retrieve the feature's projection from the layer's (by assuming that all features in a given layer are in the same projection).

jacobwod added a commit that referenced this issue Oct 21, 2021
@jacobwod
Copy link
Member

Fix pushed to develop, feel free to try it out @eri-blan.

@eri-blan
Copy link
Author

Tested, and seems to work 👍

@jacobwod
Copy link
Member

Great, closing.

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

No branches or pull requests

2 participants