[QGIS-Developer] QGIS server issue: bounding box issues

Alessandro Pasotti apasotti at gmail.com
Thu May 9 07:37:04 PDT 2019


On Thu, May 9, 2019 at 4:16 PM Eric Lemoine <eric.lemoine at oslandia.com>
wrote:

> On Thu, 9 May 2019 11:28:00 +0200
> Andreas Neumann <a.neumann at carto.net> wrote:
>
> > Hi QGIS (server) devs,
>
> Hi Andreas
>
> >
> > We came across issues around calculating bounding boxes in QGIS
> > server.
> >
> > 1. Layers with only one point feature:
> >
> > If a layer contains only one single point feature, QGIS server
> > calculates a bounding box where the minx equals maxx and miny equals
> > maxy, so resulting in a bounding box without a width and height.
> > Sounds logical to QGIS server developers,
>
>
> Yes. The BBOX of a point has minx=maxx and miny=maxy.  Even PostGIS says
> so :)
>
>
> > but combined with the fact
> > that QGIS server doesn't take into account rendered symbol sizes
> > (another issue we have, see issue nr 2), it means that no WMS client
> > will ever see this one single symbol rendered, which can't be the
> > solution here ...
>
>
> If the GetMap request's BBOX param is set to the layer extent (the
> BBOX with no dimension here) then it makes sense that there's nothing
> rendered in the resulting image.  If the GetMap request's BBOX param is
> set to a BBOX that contains the layer extent then the point should be
> rendered in the resulting image.
>
> So to me this is a client issue, not a QGIS Server issue.
>
>
> > 2. Layer bounding boxes do not take into account rendered symbol
> > sizes:
> >
> > Please have a look at
> > http://www.carto.net/neumann/temp/qgis_server_bounding_box_issue.png
> > - The green rectangle and the green arrows are not part of the QGIS
> > server rendering, but they are added as an annotation to the rendered
> > QGIS server graphics, to highlight the issues.
>
>
> What software do you use on the client side?  Does the green
> rectangle correspond to the BBOX requested by the client?  And does the
> requested BBOX equal the layer extent in this case?  Or does it contain
> the layer extent?
>
> I may be wrong but I understand that the requested BBOX (the green
> rectangle) is the layer extent.  And in that case it makes sense that
> the symbols are cut for points that are closed to the boundaries.  Again
> it's a client issue.
>
>
> > Here we have the issue that QGIS server only uses the "raw" geometry
> > of point symbols without taking into account rendered symbol sizes.
> > Now, I do understand that calculating symbol sizes is scale dependent
> > and there is no single solution to that, but again, I think the
> > current behavior of QGIS server (simply cutting off symbols at layer
> > bounding boxes) is not a good and nice behavior. At least, I think
> > the author of the WMS service should have a chance to define an extra
> > margin to be added to the bounding boxes of the raw geometries of the
> > point layer, either as a "per project" or "per layer" QGIS server
> > configuration.
> >
> > @Andrea: I wonder what Geoserver does in such cases?
> >
> > Any thoughts how to solve these issues? The current behavior of QGIS
> > server is not satisfactory to me, for both cases.
>
> I'd like to better understand the issues that you're seeing but from
> what I currently understand the behavior of QGIS Server is correct.
> Happy to be proven otherwise :)
>
> Cheers,
>

Hi Ăˆric,

I agree with you that QGIS Server does the right thing here, I think that
the main question is:

1. is the WMS GetCapabilities layer's BoundingBox meant to be the features
BBOX or can it be larger than that?
2. if the latter is true, we need a way to tell QGIS Server that he needs
to advertise a BoundingBox in GetCapabilities which is not the layer's BBOX
stored in the QGIS project but it's a different (probably larger) one.

all the rest will follow, because the client will get a larger BBOX from
GetCapabilities and it will request a larger image that has enough buffer
for the symbols.

Note that I checked mapserver and it behaves by default exactly like QGIS
Server does (I didn't check the single point but the symbols are cut-off at
the layer's bbox in general), except that mapserver allows you to override
the layer extent per-layer.

IMO the fix is in the client, either by allowing to override the layer
extent advertised by the server and to store it in the project itself (this
may require some work in the server side too in order to handle the
override) or by setting an option in the WMS provider that will always
request the canvas extent.

Cheers

-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190509/bc2a8ff7/attachment.html>


More information about the QGIS-Developer mailing list