I read Regular expression substring for labelling
and it got me curious. I'm trying to do something similar with OSM content in QGIS.
I would like to label features with English names if those names are stashed in the other_tags
attribute. If English names do not exist in the other_tags
attribute field, fall back to the name
attribute.
I've gotten only as far as finding whether an English value exists:
"other_tags" LIKE '%"name:en"=>"%'
Perhaps someone could explain to me how to put all this in a conditional check within QGIS, calling the name:en
value to be rendered as the label, and if the conditional check fails, use the name
field.
I am on QGIS 2.14.
UPDATE:
I read through QGIS Multiple CASE WHEN/THEN Statements for Expression Based Labels
and it does not answer my question. I am not concerned with how to take multiple attributes and stack them in a label. I am looking at a single attribute field in OSM called other_tags
. The structure of this tag looks like this:
"name:ar"=>"[some arabic text here]","name:ru"=>"[some russian text here]","name:en"=>"Gaziantep"....etc...
What I'm trying to do is take, for example, Gaziantep
out of "name:en"
out of the overall other_tags
field.
I can use CASE expression to roll over to the regular name
field if the conditional check fails, but how do I syntactically obtain the "name:en"
subvalue?
n
number of characters in that string until another delimiter.name:en
tags with that, and then if that doesn't exist, name it with whatever is in thename
field. And even if I did that, I'm still left with the same labeling question, because it's not putting thatname:en
value into its own attribute field.