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

[BUGFIX][Server] WMS compliance: stretched, distort, increase, decrease #3906

Merged
merged 2 commits into from
Jan 3, 2017

Conversation

rldhont
Copy link
Contributor

@rldhont rldhont commented Dec 26, 2016

The commit d44f1eb seems to break some WMS 1.3.0 client and WMS compliancy.
The commit d44f1eb has been written to fix an issue with QGIS WMS Client and to render image like other WMS Server.

This commit has been written to fix issue introduce by d44f1eb.
It is based on MapServer code:

@nyalldawson
Copy link
Collaborator

Since this seems to be a tricky calculation I'd suggest adding unit tests to protect this logic.

@rldhont
Copy link
Contributor Author

rldhont commented Dec 26, 2016

@nyalldawson, this commit comes from this discussion d44f1eb#commitcomment-20259007
Tests has to be updated but unit test are not enough. We need to verify that QGIS WMS client and other WMS client are not broken.

@rldhont rldhont force-pushed the server-wms-stretch-compliancy branch 2 times, most recently from b86cc73 to 48835dd Compare December 26, 2016 21:33
@mhugent
Copy link
Contributor

mhugent commented Dec 30, 2016

As the ms calculation uses a mixture of both ratios, I don't think it is 100% correct.
But it does not matter. The image distortion is IMHO a bad idea of the OGC spec. We should disable it completely or use the ms calculation in this PR to not have any troubles with WMS clients.

@rldhont
Copy link
Contributor Author

rldhont commented Jan 2, 2017

Thanks @mhugent

@elpaso can you test this PR ?

@elpaso
Copy link
Contributor

elpaso commented Jan 2, 2017

@rldhont you read my mind, I've just built your branch ... :)

@elpaso
Copy link
Contributor

elpaso commented Jan 2, 2017

@rldhont tested this PR with QGIS server and QGIS client and there is exactly the same problem we noticed in Lyon, in the attached image you can see the same layer (world shapefile EPSG:4326) rendered directly into QGIS (grey outline) and served through QGIS Server (the coloured polygons).
You can see how the grey outline is the correct one.
stretch_error

Copy link
Contributor

@elpaso elpaso left a comment

Choose a reason for hiding this comment

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

@rldhont, I've tested master again without this PR and it seems to me the right behavior. This PR re-introduces the bug that we've seen in Lyon.

@rldhont
Copy link
Contributor Author

rldhont commented Jan 2, 2017

hi @elpaso, can you provide the URL to the data and the URL generated by QGIS desktop to reprodiuce the issue?

@rldhont
Copy link
Contributor Author

rldhont commented Jan 2, 2017

@mhugent can you provide some example which describe the issue with openlayers that @pka has explain on Twitter?

@elpaso
Copy link
Contributor

elpaso commented Jan 2, 2017

@rldhont you can easily reproduce it:

  1. create a QGIS project with a single shapefile layer EPSG:4326 whole world
  2. serve that project through QGIS Server

then ...

  1. open QGIS and load the EPSG:4326 whole world shapefile layer directly inside QGIS
  2. add the WMS layer created in the previous steps.
  3. enjoy the difference

I checked the QGIS Desktop created URLs and they seems correct: both the BBOX and
HEIGHT/WIDTH seem correct.

Example URL generated by QGIS WMS provider (untiled):
?MAP=/opt/qgis-server/projects/world_qt5.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-40.42095738741319622,-189,71.67899928492427364,189&CRS=EPSG:4326&WIDTH=1046&HEIGHT=310&LAYERS=world&STYLES=&FORMAT=image/jpeg&DPI=220&MAP_RESOLUTION=220&FORMAT_OPTIONS=dpi:220

See what happens here with current master (not your PR):
immagine

See what happens with your PR (same call):
immagine

@rldhont
Copy link
Contributor Author

rldhont commented Jan 2, 2017

@elpaso thanks!
@mhugent any idea about the difference?

Copy link
Contributor

@sbrunner sbrunner left a comment

Choose a reason for hiding this comment

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

Why should we change the width and height, shouldn't they simply be unchanged?

@rldhont
Copy link
Contributor Author

rldhont commented Jan 3, 2017

@sbrunner the image has to be stretched by the server to be WMS 1.3.0 compliant

@sbrunner
Copy link
Contributor

sbrunner commented Jan 3, 2017

@rldhont
Copy link
Contributor Author

rldhont commented Jan 3, 2017

@mhugent and @elpaso this issue is due to the fact that the image ratio does not take account of the Change x- and y- of BBOX for WMS 1.3.0 if axis inverted.

I'll enhance the code to do so!

@rldhont rldhont force-pushed the server-wms-stretch-compliancy branch from 48835dd to 50ef9ee Compare January 3, 2017 10:55
if ( crs.compare( "CRS:84", Qt::CaseInsensitive ) == 0 )
{
crs = QString( "EPSG:4326" );
mapExtent.invert();
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you have unwanted double invert? (with the line 1991)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no crs84 is an invertion of EPSG:4326.
This code has been copy from the copyMapSettings.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks :-)

@rldhont
Copy link
Contributor Author

rldhont commented Jan 3, 2017

@elpaso and @mhugent the code has been updated to take account of axis invertion.

So with a world countries data we have:
world_countrie
SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-40.42095738741319622,-189,71.67899928492427364,189&CRS=EPSG:4326&WIDTH=1046&HEIGHT=310&LAYERS=countries&STYLES=&FORMAT=image/jpeg&DPI=220&MAP_RESOLUTION=220&FORMAT_OPTIONS=dpi:220

And I have tested with the OGC CITE ratio-aspect request and we have:
without stretched
cite-wms-aspect-ratio
SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=cite:Streams,cite:Lakes,cite:Ponds,cite:Bridges,cite:RoadSegments,cite:DividedRoutes,cite:Buildings,cite:MapNeatline&STYLES=&CRS=CRS:84&BBOX=-0.005,-0.0025,0.005,0.0025&WIDTH=200&HEIGHT=100&FORMAT=image/jpeg
with stretched
cite-wms-aspect-ratio-stretched
SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=cite:Streams,cite:Lakes,cite:Ponds,cite:Bridges,cite:RoadSegments,cite:DividedRoutes,cite:Buildings,cite:MapNeatline&STYLES=&CRS=CRS:84&BBOX=-0.005,-0.0025,0.005,0.0025&WIDTH=200&HEIGHT=200&FORMAT=image/jpeg

Are you agree with the code now ?

This was referenced Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants