[QGIS-Developer] Any ways to avoid offsets being shown in printed map legend?
Nyall Dawson
nyall.dawson at gmail.com
Mon Dec 17 14:34:02 PST 2018
On Tue, 18 Dec 2018 at 04:59, magerlin <MAP at ramboll.dk> wrote:
>
> When mapping things like bus routes it can be handy to offset routes if more
> than one route uses the same road.
>
> But I see no way to avoid the offsets also being shown in the legend off
> "printed" maps (or created pdf's, png's etc).
>
> I have just had a case, where my client says "you need to clean up those
> miss-alignments in the map-legend".
>
> I can get almost there if I hardcode the offset using "data defined
> override", but this solution only corrects the Layers panel and the "Legend
> panel" in print composer - It has no effect on the legend in the print
> composer canvas and final printed map...
The usual (gross) approach here is to create a second, disabled copy
of the layer in the project, with symbology which you only want to
show in the legend. And then your legend uses the secondary version of
this layer.
An alternative (almost as gross) approach involves hacking around
using either a rule-based renderer or data defined symbol settings to
apply your offset ONLY when the @map_id variable is non null (and then
making sure your actual layout map items have an item id set). When
rendering occurs in the legend the @map_id will be null - so this hack
lets you detect if a item is being rendered in the legend, and you can
adjust the symbology accordingly.
Best solution: we need to implement an option to double click a legend
item and tweak the symbol used for it ONLY in that particular legend.
Aside from fixing your offsets issue, this would also allow users to
tweak the colors for symbols inside a legend (useful to get a better
visual match for how the symbol actually appears on the background map
layers), or tweaking dot/dash initial offsets to make for nicely
centered line pattern symbols inside the legend. I've scoped up this
feature previously for a client, but unfortunately the work did not
proceed... let me know if you're interested in sponsoring this feature
for a future QGIS version!
Nyall
>
>
>
> -----
> Regards Morten
>
> Currently using Qgis 2.18.23 (OSGeo4) and Qgis 3.4.2 in parallel
> Windows 7, 64bit
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the QGIS-Developer
mailing list