[Qgis-user] Variables for colour values

Mofo Yoda mofoyoda at gmail.com
Tue Feb 24 06:17:29 PST 2015


Hi,
When I use data defined properties, I can set the expression for colour and width etc.
But what I really want to do is to set the variable once and use the same variable inside multiple expressions for many symbols in my project.
So I can change the value of that variable in one place, and automatically change all symbols, that use this variable in their expressions. 
It should be a kind of global variable for all symbols.

The only workaround I can think of is to store variable values as fields of data itself (I use postgis db, so this is potentially possible) and use a fields value in the expression, 
like “fill_color_field” for color, but that’s very inconvenient, and I guess there should be a better way. 
Is it possible using ‘function editor’ in expression maybe?
 

> On 24 Feb 2015, at 16:07, Jonathan Moules <J.Moules at hrwallingford.com> wrote:
> 
> Hi,
> Yes, it is.
> You want the "Data defined properties" button, which you'll see when you click on a style (in 2.6.1, it's at the bottom of the list of style options.
> 
> The variables need to be of a specific datatype/structure for each item you want to style. So Pen Width requires a double. Colour is more complex, requiring a RGBA string. The dialog shows what's necessary.
> 
> Cheers,
> Jonathan
> 
> -----Original Message-----
> From: qgis-user-bounces at lists.osgeo.org [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of Mofo Yoda
> Sent: Tuesday, February 24, 2015 11:19 AM
> To: qgis-user at lists.osgeo.org
> Subject: [Qgis-user] Variables for colour values
> 
> I wonder if it’s possible to use variables for colour values, line widths etc? I have rule-based styling with lots of rules, and I want to change the colour value in one place and not in every rule that uses the same symbol. I’ve been using variables a lot in CartoCSS styling, but I really miss them in QGIS. Since I can define project colours with names in QGIS, i thought it may be possible somehow.
> I’m on QGIS 2.8 for OS X.
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
> 
> This message has been scanned for viruses by MailControl - www.mailcontrol.com
> 
> 
> 
> Click https://www.mailcontrol.com/sr/mFTpBfgLOMLGX2PQPOmvUgZ1F1vOh!vyYC82CsCGa!dzAI3m6djTRny+7419ROQTNWG5s0VsQtSURD1dro2FIg== to report this email as spam.
> 
> ________________________________
> 
> HR Wallingford and its subsidiaries uses faxes and emails for confidential and legally privileged business communications. They do not of themselves create legal commitments. Disclosure to parties other than addressees requires our specific consent. We are not liable for unauthorised disclosures nor reliance upon them.
> If you have received this message in error please advise us immediately and destroy all copies of it.
> 
> HR Wallingford Limited
> Howbery Park, Wallingford, Oxfordshire, OX10 8BA, United Kingdom
> Registered in England No. 02562099
> 
> ________________________________




More information about the Qgis-user mailing list