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

Label masking and composer export bug #50543

Closed
2 tasks done
eprouteau opened this issue Oct 13, 2022 · 38 comments
Closed
2 tasks done

Label masking and composer export bug #50543

eprouteau opened this issue Oct 13, 2022 · 38 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Labeling Related to QGIS map labeling Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Regression Something which used to work, but doesn't anymore

Comments

@eprouteau
Copy link

eprouteau commented Oct 13, 2022

What is the bug or the crash?

Context : Hiking map with a lot of labels (lakes, peak, saddle, places, ...) and OSM road network.

labels have an active mask property on the road network.

When the Label masking property is activate on road network, an export with composer taker very long time or crash. When the property is disable no problem.

A try on qgis 2.22.4 and there is no problems

Steps to reproduce the issue

Label masking property enable on all label layer and active on road network. Composer export bug

Versions

2.26.3

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@eprouteau eprouteau added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 13, 2022
@troopa81
Copy link
Contributor

Could you share a project with sample data?

@agiudiceandrea agiudiceandrea added Labeling Related to QGIS map labeling Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Crash/Data Corruption labels Oct 16, 2022
@C4pT4in0bvi0u5
Copy link

@troopa81 My project file is posted over on issue #50734 and produces the same symptoms.

@agiudiceandrea
Copy link
Contributor

On Windows 10, the issue doesn't occur using QGIS 3.22.12, while it does using QGIS 3.28.0 and the latest QGIS 3.29.0-Master (2a3cdfd).

@agiudiceandrea agiudiceandrea added the Regression Something which used to work, but doesn't anymore label Nov 2, 2022
@troopa81
Copy link
Contributor

troopa81 commented Nov 3, 2022

On Windows 10, the issue doesn't occur using QGIS 3.22.12, while it does using QGIS 3.28.0 and the latest QGIS 3.29.0-Master (2a3cdfd).

I imagine it's related to #47459 which appears on 3.26. In 3.22, the result must be fully rasterized even if you select the option full vector when exporting.

@C4pT4in0bvi0u5 You can disable the full vector export options, it would certainly work and you'll have your masks, but the result will be fully rasterized.

Thanks for the project sample and data, I'll try to take a look at it when I get the time (not quite soon I'm afraid).

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Nov 4, 2022

@troopa81 I don't see any "rasterize" or "vector" options when printing from layout or exporting to PNG. So not sure what exactly you're talking about. I seem to remember a "vector" setting for PDF somewhere, but this is not a problem that is limited to PDF.

Doesn't matter anyway, because there is clearly a problem with printing/exporting in 3.26 and up. Just use 3.22.12 if you want something that works. Trying to find workarounds seems pointless to me.

@troopa81
Copy link
Contributor

troopa81 commented Nov 7, 2022

Doesn't matter anyway, because there is clearly a problem with printing/exporting in 3.26 and up. Just use 3.22.12 if you want something that works. Trying to find workarounds seems pointless to me.

There is clearly an issue, but I would like to be sure it's only related to export with full vector option (see this comment) and it's the same issue than #50785

Are you sure that you have the issue when you export in PNG ? If yes, could you please share the stacktrace when it crashes!

@agiudiceandrea
Copy link
Contributor

Are you sure that you have the issue when you export in PNG

Yes, the issue occurs exporting in PNG.

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Nov 8, 2022

Are you sure that you have the issue when you export in PNG ?

Yes. Quite sure.

please share the stacktrace when it crashes!

No idea how to get a stacktrace. This is NOT a difficult problem to reproduce.

@agiudiceandrea
Copy link
Contributor

A duplicate issue report contains a stack trace: #50785 (comment).

@MarcelFernandesCGEO
Copy link

Hi!
Any news on this issue?
I have the same problem. Just disable the option to mask the labels so that the export in any format works again.
QGIS 3.24.3 works fine, but 3.26.x and 3.28.x fail.
The maps I export have many layers and generate large files, so it's difficult to get the error log (stracktrace) when QGIS crashes.

@troopa81
Copy link
Contributor

Any news on this issue?

Yes, like I said in this comment, and contrary to what I thought, there is no way to have a full raster-only rendering, and the vector way of rendering selective masking is very slow.

I try to find a solution to this.

@syntax42
Copy link

syntax42 commented Dec 3, 2022

I too seem to have run into this problem. When using label masking and exporting as raster file, i sometimes get the crash (without any error popping up). It seems to be an intermittent issue, so maybe related to memory handling? If needed i can help test any bug fix or provide more details on the problem.

@CharlesGag
Copy link

I have the same issue, map size goes from 3MB to 98.6MB. If I mask additional layers with my unique mask, it crashes while exporting.

@tdeboss
Copy link

tdeboss commented Apr 10, 2023

Are there any news on this very annoying bug, that practically renders inusable a great deal of Qgis?

@jsehner
Copy link

jsehner commented Apr 10, 2023

Same for us, a big cartographic agency in Germany: selective masking is a great feature of QGIS, but we have to stay at version 3.22 to export the maps in a raster format. In future hopefully also in vector format. Would be great to see progress with this bug.

@troopa81
Copy link
Contributor

Hi @tdeboss and @jsehner I'm well aware about this issue and I don't fortget it. However, I fail to find time to improve things here.

If you're interested in funding you can contact me here : julien dot cabieces at oslandia dot com

Otherwise, I'll try to fix it in the next QGIS bugfix round

@agiudiceandrea
Copy link
Contributor

See also: #55874.

@oskarlin
Copy link

oskarlin commented Feb 29, 2024

How's it going with this? This problem is still very annoying since I still have to use 3.24.3 in order to export images from QGIS. It's been over two years now...

Since then we're using silicon Macs and with the new ARM64 versions of QGIS which is so much faster. But this new version still can't export images.

@troopa81
Copy link
Contributor

I failed to find the time to work on this in the previous bug fix round.

@oskarlin
Copy link

oskarlin commented Mar 7, 2024

I failed to find the time to work on this in the previous bug fix round.

I emailed you the other day to see if you could get an estimate on fixing this. Did you get it?

@zoran-cuckovic
Copy link

Hello,
Same problem here, with 3.34 version. When label masking is turned on both map composer exports and screenshot exports hang for 10 minutes or so. The output is broken, transparency seems to be reverted to 0%, in spite of layer symbology settings.
It took me quite a while to discover the cause of the problem - this issue is probably affecting a large number of users who may be unaware of the cause.

@FeroS66
Copy link

FeroS66 commented May 14, 2024

Long time problem(s). Several time closed "because no activity in thread".
I have to use QGIS 3.22 for output.

@oskarlin
Copy link

Maybe we could go together and finance this? @troopa81 is interested to help out.

@agiudiceandrea
Copy link
Contributor

Several time closed "because no activity in thread"

This issue repor was never been closed.

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 23, 2024

QGIS v3.38.0RC is confirmed working. Thank you for fixing this huge bug!

[EDIT:} Nope, still glitching. See below.

@agiudiceandrea agiudiceandrea added Feedback Waiting on the submitter for answers and removed Feedback Waiting on the submitter for answers labels Jun 23, 2024
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jun 23, 2024

@troopa81, I think this issue report can be closed now.

@nyalldawson
Copy link
Collaborator

@C4pT4in0bvi0u5

You should try switching to the new geometry based backend, which will give much better results on QGIS 3.38+ (and MUCH better results on 3.38.1, when that's released.)

From the Python console enter:

QgsSettings().setValue('map/mask-backend', 'geometry')

@troopa81
Copy link
Contributor

QGIS v3.38.0 is confirmed working. Thank you for fixing this huge bug!

All modifications brought recently by @nyalldawson are non default, so I'm wondering how it could actually work.

I'm hesitating at closing this, because I think the issue still exists. @nyalldawson What do you think?

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 24, 2024

3.38.0 took a bloody long time to finish rendering... but it completed the render, gave me a usable file, and didn't crash. That's progress.

I'm using QGIS in stock configuration.

To be fair, as there has been basically no activity on this bug for the last 2 years, I had no reason to check every QGIS version that came out. I've been using the known-working 3.22.12 version. So perhaps the crashing issue was "accidentally" fixed before now?

@nyalldawson
Copy link
Collaborator

@C4pT4in0bvi0u5 can you confirm you tried with the qsettings switch to the new backend?

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 25, 2024

Trying v3.38.0RC again today, and it's back to it's old tricks. Crashes after 2 minutes.

  • Tried the Python switch mentioned above, still crashes.
  • Uninstalled, reinstalled, tried again without the switch. Still crashes.
  • Tried a lower (96 dpi) resolution render, still crashes.

When it worked yesterday, the progress bar on the bottom of the QGIS window showed grey (0% complete) throughout the operation. Today when it doesn't work, the progress bar is blue (100% complete) throughout the operation. Not sure if this means anything, but it's just something I noticed.

The big mystery is: why did it work yesterday?

Here's the project I used (slightly more refined version of the last one I posted): temp QGIS project 2.zip (Yes I know the project is crude. This is a test file.)

@nyalldawson
Copy link
Collaborator

nyalldawson commented Jun 25, 2024

@C4pT4in0bvi0u5 can you try with the build from #57839 (comment) ?

Here's a (realtime!) screen recording of exporting the layouts from your sample project using that build:

Peek.2024-06-25.10-25.mp4

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 25, 2024

@C4pT4in0bvi0u5 did you see my question?

From my last post:

  • Tried the Python switch mentioned above, still crashes.
  • Uninstalled, reinstalled, tried again without the switch. Still crashes.

I have not tried the build from the other thread. The one I've been trying in the past couple days is 3.38.0-1 from https://download.osgeo.org/qgis/win64/

I will download and try the other build.

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 25, 2024

  • Downloaded and launched "backport" portable QGIS version from above.
  • QGIS promptly crashed while launching.
  • QGIS launched successfully on second attempt. Information message that "Plugin MetaSearch" has been disabled because it previously crashed QGIS.
  • Loaded the project posted above (temp QGIS project 2).
  • Attempted rendering to PNG image, 600 dpi. Render successful, usable file produced.
  • Opened Python console (Plugins menu -> Python console), entered the command: QgsSettings().setValue('map/mask-backend', 'geometry')
  • Attempted rendering to PNG image, 600 dpi. Render successful, usable file produced.
  • The two rendered files are slightly different file sizes, and not bit-identical. Both renders took similar amounts of time ( I didn't time them exactly). Both renders are usable.

If everything still works tomorrow, we might be making progress here!

@C4pT4in0bvi0u5
Copy link

C4pT4in0bvi0u5 commented Jun 26, 2024

Tried again today with a different map project in the 'backport' QGIS version, and both rendering methods still function properly (new/old backends).

Render times between the 2 methods were very similar to each other. Reasonably quick renders: Seconds, not minutes or hours.

The important thing is that everything seems to work. That's a win, IMHO.

@est987
Copy link

est987 commented Jul 24, 2024

I have been having this issue for a while, and managed to isolate it to issues with the mask feature.
When labels with mask intersect small number of features only transparency fails. Rendering time becomes extremely slow and eventually crashes when label masks intersect with many features.

Most simple scenario:

New project using QGIS LTR 3.34.8:
Created a simple polygon with transparency set to 50%, with label on edge.
With mask enabled on label:
Layout 1
With mask disabled on label:
Layout 2
Transperency set at 50% for both examples.

Attaching project file as GPKG:
MaskTest.zip

@nyalldawson
Copy link
Collaborator

@est987 please test with 3.38.1 -- these issues should be resolved. Please open a new issue if you can still reproduce on 3.38.1

@est987
Copy link

est987 commented Jul 24, 2024

Reproduced issue also in 3.38.1:
#58230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Labeling Related to QGIS map labeling Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests