-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use CRS in WMS GetFeatureInfo when info_format is in json Fixes #32326 #32386
Conversation
Good work @pblottiere The good newsTested locally and it works perfectly with Not so good newsIt is odd, but the same project, if I request To reproduceUsing the previous project stored in the export QGIS_PROJECT_FILE="geopackage:/home/qgis/projects/gfi.gpkg?projectName=testgfi"
export QUERY_STRING="SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image/png&TRANSPARENT=true&tiled=false&STYLES=default&LAYERS=freguesias&CRS=EPSG:3857&WIDTH=512&HEIGHT=512&BBOX=-953087.8,4973324.9,-952748.9,4973612.8&QUERY_LAYERS=freguesias&INFO_FORMAT=application/json&FEATURE_COUNT=50&WITH_GEOMETRY=True&I=222&J=127"
./build-QGIS-Desktop-Debug/output/bin/qgis_mapserv.fcgi The request uses EPSG:3857 coordinates, around -953 087, 4 973 324. The coordinates in JSON are around -7 194 793, 15 428 040. {
"features": [
{
"bbox": [
-7202100.975262,
15370117.593422,
-7179015.488842,
15428040.830143001
],
"geometry": {
"coordinates": [
[
[
[
-7194793.711287,
15428040.830143001
],
[
-7194757.735689,
15428031.546399
], I've attached the resulting file x.json. If you open it with QGIS (and assign the EPSG:3857), it goes to the north pole. Unless it is a local issue (or my mistake), when the output is json, the conversion might not work as expected. |
1ab5cc9
to
33a195f
Compare
Hi @jgrocha,
Ah yes, I forgot the second part of your issue, sorry for that.
I think it's fixed now. In both cases we have the same coordinates (excepted for the precision which is slightly different). INFO_FORMAT=text/xml and CRS=EPSG:3857
INFO_FORMAT=application/json and CRS=EPSG:3857
Can you take a look locally with your own project to make sure that everything is OK please? |
Hi @pblottiere, Thanks for keeping working on this PR. The example with EPSG:3857 is working now. Nice work! But... but we still have issues with CRS transformations. I've made a request with EPSG:4326 coordinates and the result is an empty image. The GetMap fails (and GetFeatureInfo as well). Please test it, because it might be my fault. For the very same project: export QUERY_STRING="SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&tiled=false&STYLES=default&LAYERS=freguesias&CRS=EPSG:4326&WIDTH=512&HEIGHT=512&BBOX=-8.61,40.70,-8.53,40.77"
./build-QGIS-Desktop-Debug/output/bin/qgis_mapserv.fcgi > image.png The image is empty! export QUERY_STRING="SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image/png&TRANSPARENT=true&tiled=false&STYLES=default&LAYERS=freguesias&CRS=EPSG:4326&WIDTH=512&HEIGHT=512&BBOX=-8.61,40.70,-8.53,40.77&QUERY_LAYERS=freguesias&INFO_FORMAT=application/json&FEATURE_COUNT=50&WITH_GEOMETRY=True&I=222&J=127"
./build-QGIS-Desktop-Debug/output/bin/qgis_mapserv.fcgi The output is empty. Please confirm that you also get an empty map when using EPSG:4326 against the very same project. I'll prepare another project, based on EPSG:4258 (used all over Europe) to use for these tests. |
Hi @jgrocha,
Actually, the axis order for >>> crs = QgsCoordinateReferenceSystem.fromOgcWmsCrs("EPSG:4326")
>>> crs.hasAxisInverted()
True
>>> crs = QgsCoordinateReferenceSystem.fromOgcWmsCrs("EPSG:3857")
>>> crs.hasAxisInverted()
False And according to the WMS 1.3.0 specification:
So you have to invert the axis within the BBOX=40.70,-8.61,40.77,-8.53 |
@pblottiere Thank you for testing. I don't trust my self :-) I've tested once more and everything is running file. I think this PR is good to merge. |
a6f36b6
to
624ae03
Compare
Co-Authored-By: Alessandro Pasotti <[email protected]>
@pblottiere how do you feel about backporting to 3.10? |
@pblottiere nevermind, I've found a workaround to trick the JSON exporter. |
Hi @elpaso,
I had planned to backport this bugfix anyway. I'm probably going to do it early next week. |
This is required because of a missing API that was added with qgis#32386
Description
Fixes #32326