samedi 29 novembre 2014

How to make QGIS abbreviate labels with a dictionary?


I'm trying to use qgis "expression dialog" for labeling a layer. What I'm looking for is an expression that permits to apply some abbreviation rules on the layer. For now i'm using this



CASE
WHEN nome2 is not null THEN replace("nome1" || '$' || "nome2", 'Wasserfall', 'Wssf.')
WHEN nome2 is not null THEN replace("nome1" || '$' || "nome2", 'CascatA', 'Casc.')
WHEN nome2 is not null THEN replace("nome1" || '$' || "nome2", 'Cascate', 'Casc.e')
WHEN nome2 is null THEN replace("nome1", 'Wasserfall', 'Wssf.')
WHEN nome2 is null THEN replace("nome1", 'Cascata', 'Casc.')
WHEN nome2 is null THEN replace("nome1", 'Cascate', 'Casc.e')
END


Obviously it doesn't work because only the first condition (wasserfall) is used for the label.


It happens something like that


Wasserfall$Cascata -> Wssf.$Cascata


instead of


Wasserfall$Cascata -> Wssf.$Casc.


I can solve the problem directly in postgis (with a view or a simple update) but if it is possibile to do it in qgis it would be great. Most of all it would be great to use an abbreviation dictionary but I'm quite sure that qgis (for now) is not able to doing it. I'm on W7 qgis 2.4.





Aucun commentaire:

Enregistrer un commentaire