To achieve the desired output
apply the following settings for
Colour
Use the following expression in the Expression String Builder
CASE
WHEN "Field1" = 2 THEN '#264653'
WHEN "Field1" = 9 THEN '#2A9D8F'
WHEN "Field1" = 16 THEN '#E9C46A'
WHEN "Field1" = 18 THEN '#F4A261'
ELSE '#E76F51'
END
Line centroid symbology
Firstly Add symbol layer and make an SVG-marker out of it. After trying the following expression in the Expression String Builder for Dynamic SVG parameters
CASE
WHEN "Field2" = 1 THEN 'P://Test//qgis_test//socicon_amazon.svg'
WHEN "Field2" = 3 THEN 'P://Test//qgis_test//socicon_apple.svg'
WHEN "Field2" = 8 THEN 'P://Test//qgis_test//socicon_github.svg'
WHEN "Field2" = 13 THEN 'P://Test//qgis_test//socicon_google+.svg'
ELSE 'P://Test//qgis_test//socicon_mail.svg'
END
Note: Central point was used for Marker placement.
Currently changing(overriding) simultaneously the colour and style of the SVG-file can not be done.
An Attempt
With this approach, you can get control over your symbology, see the image below.
Unfortunately, in this case, it is not possible to adjust the colour that easily. I was hoping to apply the method as was mentioned in one of my previous solutions.
Working Solution #1
Using the Categorized symbology
Working Solution #2
Using the Rule-based symbology
Disadvantage: In both approaches you will need manually to change the colour (⚠️ not dependent on the "Field2"
)
I am on Windows 10 with QGIS 3.18.1-Zürich.
References:
Best Answer
In tool "Mean coordinate(s)" from the QGIS's Processing Toolbox (Ctrl+Alt+T) use Unique
"ID"
field.