Using special characters in QGIS expressions
This brief text explains how to use some custom symbols in QGIS expression. Obviously, it applies only to the quoted part, which represents the bits with string.
There are 2 ways of doing it.
The first method uses the char() element, which can give us the desired symbol, letter, or icon. In the case of degrees, it will be (Pic. 1):
18 || char(730)
Considering a few other examples, we could list:
char(730) – degree symbol
char(0176) – bigger degree symbol
char(0163) – the £ symbol
char(0169) – the copyright symbol
char(999999999) – 짿
In total, we have 65535 special characters available in QGIS! They include various symbols, letters in all languages, and emoticons. Indeed, you can feel seriously overwhelmed by it! It’s rather pointless to draw lots between such a massive list of characters. In fact, I’ve prepared some of them for you, which are available here, but for some of you, these lists might be still not sufficient. When you don’t know what number is assigned to the character you want to attach to your label in expression, then the second method will be tailor-made for you.
You will need to open MS Word and next: Main toolbar -> Insert -> Symbol -> More symbols where you will find the interesting one if not visible in the handy list (last used) appearing right under the Symbol (Pic. 3).
Once your symbol appears on the page, select it and copy (Ctrl + C), then paste it (Ctrl + V) between the quotes (‘ ‘) in your QGIS expression (Pic. 4).
The result will be exactly the same! (Pic. 4).
Mariusz Krukar
Links:
- https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/expression.html
- https://umar-yusuf.blogspot.com/2018/09/qgis-add-delimited-text-layer-with.html
- https://www.rapidtables.com/code/text/unicode-characters.html
Forums:
- https://gis.stackexchange.com/questions/80710/openlayers-how-to-display-the-character-degrees-in-the-label
- https://gis.stackexchange.com/questions/282386/adding-text-to-label-expression-in-qgis
- Github.com: Encoding issue for special chars in labels
- How to correctly replace a special character into an apostrophe using the replace function in QGIS Field Calculator? The expression below says it is invalid; what’s the correct syntax? Thanks!
- https://gis.stackexchange.com/questions/219643/special-characters-in-qgis-script-tools
- https://gis.stackexchange.com/questions/393519/how-to-get-a-text-character-based-on-a-number-position-in-the-alphabet-in-a-qgis
- https://gis.stackexchange.com/questions/90076/are-unicode-symbols-supported-in-qgis-labels
- https://gis.stackexchange.com/questions/31885/how-to-display-special-german-characters-%C3%84%C3%9C%C3%96%C3%9F-in-a-map
- QGIS displays all 65535 Unicode characters in Font Marker symbol selection window
- Github.com: QGIS displays all 65535 Unicode characters in Font Marker symbol selection window
Wiki:
Youtube:
Thank you I have just been searching for information approximately this topic for a while and yours is the best I have found out so far However what in regards to the bottom line Are you certain concerning the supply