3

I am mapping animals and have to display their locations in QGIS (2.12.3, Win7 64) with gender symbols (♂/♀). The outline of the symbols should be rendered in different colors corresponding to the dates of survey. The filling should be either colored or transparent respective to classes of behavior. So I generated the svg symbols with INKSCAPE and then replaced the whole „style“-line in the svg file text

style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:10.00027084;… … ...“

with

fill="param(fill) #000" fill-opacity="param(fill-opacity) 0.0" stroke="param(outline) #000" stroke-width="param(outline-width) 3"

In QGIS I used attribute-driven rendering for the outline (attribute field “color“) and an expression to choose between either transparency or fill (case when “behav“ <> '+' then '0,0,0,0' else “color“ end)

The outline, both color and width, was displayed as I intended. In contrast, I had no control over the fill. Sometimes all symbols were filled, no matter what the attribute says, sometimes all fillings remained transparent and in the third case the symbols that should be transparent had a black (or white) fill. When I closed and reopened QGIS, the rendering of all fills changed sometimes. The outline, however, was displayed correct all the time.

Instead of '0,0,0,0' in the case-when expression above I experimented with other statements, e.g. '#000000 0.0' or 'default' to achieve correct rendering of color or transparency, but without success. I also varied the default values in the “param(…)...“ statements and omitted the whole “fill-opacity...“ statement. Again without gaining control over the fill.

In addition, it was strange to see that sometimes the fill of all symbols changed from transparent to color or vice versa when I varied the outline width. I then introduced fill-rule=”evenodd”, but again without visible effect.

I have no idea what's wrong.

1 Answer 1

2

I have faced problems in QGIS when I have been using somewhat complicated expressions, they just don't seem to work like they should.

You might be better off just using Rule Based Styles, you can set Rules to define which symbol to use based on the columns you have (Gender and Year) by applying filters, then you can the customize the applicable symbol in the style manager (you should be able to edit the fill and transparency of the symbols with no issues, and be able to save the symbology)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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