TransWikia.com

Automatically replace values in Geometry generator's expression in all symbol layers of feature

Geographic Information Systems Asked on June 4, 2021

I have created some piecharts in QGIS 3.14 with the geometry generator (see here why it was not possible to use the built-in piecharts from the layer properties).

I now have 10 piecharts, each with several sectors (slices) styled in different pattern-styles, see screenshot below for how it looks. Some of the piecharts are not located in an ideal place, so I want to re-position them somewhere else – using the project(point,distance,azimuth) expression in the geometry generator.

However, for this I have to change the expression for each sector/slice separately as I built the piechart with wedge_buffer, creating a separate symbol layer for each sector/slice.

I could use a variable as explained here, but that’s not the point since I would have to introduce the variable manually for each symbol layer.

Is it possible to automatically replace the values of distance and azimuth (or any other part of the expression in the geometry generator) automatically, by iterating over all symbol layers (like the highlighted examples no. 1 and no. 2 in the screenshot) and not by changing each symbol layer manually one by one? I am looking for something like "search for x and replace with y" over all symbol layers of a feature.

enter image description here

2 Answers

Being a symbology created using the Geometry generator you can solve your problem just considering the piechart as normal geometries.

With the Advance editing tool Move you can just move the piechart/geometry in the requested position.

To avoid the alteration of the original geometry you can duplicate the layer and move the duplicate.

Correct answer by Val P on June 4, 2021

In another context, I found a quite easy way to search/replace all the settings in the geometry-generator - and make changes to settings in a project in general: save the whole project as .qgs file (NOT .qgz, the default filetype for projects since QGIS 3.0). Then open it with a text editor. As QGIS projects are saved in plain text (zipped in case of qgz), it is possible to search/replace here - save - done and reopen project.

Like this, it is possible to replace the absolute values for radius and angle (as in the screenshot above) with a variable to have a better option to change these values later at once for all instances directly in QGIS.

Answered by Babel on June 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP