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

QGIS Server GetPrint: HIGHLIGHT_GEOM is not printed if map layers are configured to follow a map theme #34178

Closed
jgrocha opened this issue Jan 31, 2020 · 7 comments · Fixed by #43391
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server

Comments

@jgrocha
Copy link
Member

jgrocha commented Jan 31, 2020

Describe the bug

The HIGHLIGHT_GEOM is handy to print some additional geometry on top of an existing layout.

If the user chooses to "follow a map theme", in the map properties, the additional geometry is not printed. The layers printed are the ones on the theme, as expected, but not the HIGHLIGHT_GEOM.

follow map theme

In my use case, I want to provide always the same layers to be printed (a set of official layers) plus the geometry (the parcel) edited by the user on the web.

This can be considered a feature request.

How to Reproduce

Using two almost identical layouts (one the "follow a map theme" set and the other not) and issue a GetPrint request with an additional geometry.

QGIS and OS versions

QGIS Master

@jgrocha jgrocha added Bug Either a bug report, or a bug fix. Let's hope for the latter! Server Related to QGIS server labels Jan 31, 2020
@elpaso
Copy link
Contributor

elpaso commented Jan 31, 2020

please attach a project and data to reproduce.

@elpaso elpaso added the Feedback Waiting on the submitter for answers label Jan 31, 2020
@jgrocha
Copy link
Member Author

jgrocha commented Jan 31, 2020

Test project

I've created a very simple project with two layers and two layouts. The project is inside the same geopackage.

severdovouga.gpkg.zip

Capabilities

The geopackage should be stored some where on the server, where QGIS Server can have access.

http://qgis.demo/cgi-bin/qgis_mapserv.fcgi?MAP=geopackage:/home/qgis/projects/severdovouga.gpkg?projectName=highlight&request=GetCapabilities&service=WMS

Requests

To test QGIS Server, we issue two GetPrint requests, both adding an highlight geometry, that should appear in both outputs.

The difference between the two reuests are hthe layout configuration. One has the layers locaked to a spcific theme, while the other doesn't.

Request (Layout 1 copy layout has "Follow theme" selected)

This request fails to show the highlight on the output.

curl 'http://qgis.demo/cgi-bin/qgis_mapserv.fcgi' -H 'Content-Type: image/png' --data-binary 'MAP=geopackage:/home/qgis/projects/severdovouga.gpkg%3FprojectName=highlight&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetPrint&FORMAT=png&TRANSPARENT=true&TEMPLATE=Layout 1 copy&DPI=400&SRS=EPSG:3763&map0:extent=-16229.391033824511,120835.22371531081,-15816.92146617551,121100.47745656419&LAYERS=severdovouga&map0:HIGHLIGHT_GEOM=POLYGON((-16193.624023437511 120987.775390625,-15914.676757812511 121116.1796875,-15852.688476562511 120930.21484375,-16113.924804687511 120819.521484375,-16193.624023437511 120987.775390625))&map0:HIGHLIGHT_SYMBOL=<StyledLayerDescriptor><UserStyle><Name>Highlight</Name> <FeatureTypeStyle> <Rule> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>circle</WellKnownName> <Fill> <CssParameter name="fill">%236699FF</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%23ffffff</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </Mark> <Size>8</Size> </Graphic> </PointSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <SvgParameter name="stroke">%23ffffff</SvgParameter> <SvgParameter name="stroke-width">5</SvgParameter> <SvgParameter name="stroke-linecap">round</SvgParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <SvgParameter name="stroke">%236699FF</SvgParameter> <SvgParameter name="stroke-width">3</SvgParameter> <SvgParameter name="stroke-linecap">round</SvgParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <PolygonSymbolizer> <Fill> <CssParameter name="fill">%236699FF</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%23ffffff</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </PolygonSymbolizer> </Rule> </FeatureTypeStyle></UserStyle></StyledLayerDescriptor>' --compressed --output notok.png

Output

notok

Request (Layout 1 layout doesn't have "Follow theme" selected).

The output is properly rendered, with the highlight geometry, as requested.

curl 'http://qgis.demo/cgi-bin/qgis_mapserv.fcgi' -H 'Content-Type: image/png' --data-binary 'MAP=geopackage:/home/qgis/projects/severdovouga.gpkg%3FprojectName=highlight&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetPrint&FORMAT=png&TRANSPARENT=true&TEMPLATE=Layout 1&DPI=400&SRS=EPSG:3763&map0:extent=-16229.391033824511,120835.22371531081,-15816.92146617551,121100.47745656419&LAYERS=severdovouga&map0:HIGHLIGHT_GEOM=POLYGON((-16193.624023437511 120987.775390625,-15914.676757812511 121116.1796875,-15852.688476562511 120930.21484375,-16113.924804687511 120819.521484375,-16193.624023437511 120987.775390625))&map0:HIGHLIGHT_SYMBOL=<StyledLayerDescriptor><UserStyle><Name>Highlight</Name> <FeatureTypeStyle> <Rule> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>circle</WellKnownName> <Fill> <CssParameter name="fill">%236699FF</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%23ffffff</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </Mark> <Size>8</Size> </Graphic> </PointSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <SvgParameter name="stroke">%23ffffff</SvgParameter> <SvgParameter name="stroke-width">5</SvgParameter> <SvgParameter name="stroke-linecap">round</SvgParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <SvgParameter name="stroke">%236699FF</SvgParameter> <SvgParameter name="stroke-width">3</SvgParameter> <SvgParameter name="stroke-linecap">round</SvgParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <PolygonSymbolizer> <Fill> <CssParameter name="fill">%236699FF</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%23ffffff</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </PolygonSymbolizer> </Rule> </FeatureTypeStyle></UserStyle></StyledLayerDescriptor>' --compressed --output ok.png

Output

ok

@elpaso
Copy link
Contributor

elpaso commented May 25, 2021

@jgrocha I can reproduce the issue but I'm not sure it's a bug: the theme 'One' does not contain the polygon layer so I guess it's expected to not see it in the output even if highlight is set.

@gioman gioman added the Feedback Waiting on the submitter for answers label May 25, 2021
@elpaso
Copy link
Contributor

elpaso commented May 25, 2021

mmm rethinking this it might be a bug, let me check the code.

@elpaso elpaso added Bug Either a bug report, or a bug fix. Let's hope for the latter! and removed Feature Request Feedback Waiting on the submitter for answers labels May 25, 2021
@elpaso
Copy link
Contributor

elpaso commented May 25, 2021

Confirmed bug

@elpaso elpaso self-assigned this May 25, 2021
@jgrocha
Copy link
Member Author

jgrocha commented May 25, 2021

Thanks you @elpaso for looking into this issue. As you can see, I've already submitted a fix #38207. The discussing about the fix is valuable. It has clues about the best way to fix this (without using the approach I've taken at the time).

@rldhont
Copy link
Contributor

rldhont commented May 28, 2021

Is this bug affected 3.16 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment