2

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 looing for something like "serach for x and replace with y" over all symbol layers of a feature.

enter image description here

4
  • 1
    It would be possible using replace("column",'tobereplaced','replacement') if you had created the symbology using the attribute table. In your case, I doubt it is, but there are wiser people out there. – Erik Jul 13 '20 at 11:24
  • 1
    What happens if you just move the symbol using the Advanced Editing tool? – Val P Jul 13 '20 at 11:44
  • Sometimes the easiest idea is the best one: thank you Val P, the solution seems to be so obvious that I didn't even think to it. I can duplicate the layer and move the piecahrts there, as the underlaying geometry will me moved, too (but I want to hae it in place). So on the duplicated layer, I simply set the geometry to invisible and than move the pies. If you post your idea as answer, I will accept it. – Babel Jul 13 '20 at 12:04
  • It sounds too easy to use as answers but, of course, it can help other people. Happy to help you. – Val P Jul 13 '20 at 12:23
2

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.