qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.61k stars 3.01k forks source link

PDF Export: Package layout items with specific layers #36528

Open davidlgalt opened 4 years ago

davidlgalt commented 4 years ago

Option to package a legend item with a layer so that when the layer is turned off on the PDF document, it also hides its associated legend item.** This might be an easier said than done request, but it would be an eloquent addition to PDF exports. I have one example of a map that includes 13 raster layers depicting various demographic and user-provided data. It only makes sense to view one layer at a time but I need to have a legend that includes all 13 layers. That takes up a lot of real estate on PDFs that are most powerful as slides in online presentations.

nyalldawson commented 4 years ago

Number 4 is quite tricky. The only way I can see to handle that would be to generate legends of every possible layer visibility combination, and control their visibility based on the overall combination of visible layers. Otherwise the size and layout of the legend will be messed up if individual parts of it are hidden...

nyalldawson commented 4 years ago

Are you able to file seperate tickets for each enhancement? All-in-one tickets like this are discouraged and rarely get attention.

davidlgalt commented 4 years ago

I'll make separate tickets and change this one to the 4th option.

davidlgalt commented 4 years ago

Here's one possibility: Tie layout item IDs to specific layers. Within the layer's properties, you could set an expression, for example for the layer: Population Density LayoutID LIKE '%popden%. That way any layout element where the user has changed the ID to include popden will be packaged with the layer.

Another possibility (and probably the more practical one) would be to have a property within all layout elements that ties that element to a specific layer.

These potential solutions would put the responsibility on the user. If I had 13 raster layers that are only designed to be looked at one at a time, I would need to create 13 separate legend items that would each be associated with a parent layer.