Feature request #16804

EXP DIALOG AND (RANDOM) COLOUR_RGB

Added by f ffierm over 6 years ago. Updated over 6 years ago.

Status:Rejected
Priority:Normal
Assignee:-
Category:Expressions
Pull Request or Patch supplied:No Resolution:invalid
Easy fix?:No Copied to github as #:24703

Description

Hi,

after loading a vector data, polygon, I would to display a thematic map using: VECTOR LAYER - PROPERTIES - STYLE - CATEGORIZED - EXPRESSION DIALOG with this code:
CASE
WHEN "layer" ='value_1' THEN color_rgb( 0,0,0)
WHEN "layer" ='value_2' THEN color_rgb( 110,110,110)
WHEN "layer" ='value_3' THEN color_rgb( 255,255,255)
END

When I apply the request, QGIs show "wrong" RGB code (the same happens using color_cmyk).
What goes wrong? May you help, please?

Thanks

Ciao,
f.fiermonte

History

#1 Updated by Nyall Dawson over 6 years ago

  • Resolution set to invalid
  • Status changed from Open to Rejected

That's not correct use of categorised renderer.

Categorize on the attribute "layer" and then set the color manually for each generated symbol.

Or alternatively (more complex way) use the single symbol renderer and then use your expression as a data defined fill color override.

Please open a question on http://gis.stackexchange.com/ if you need further assistance of this nature (it's not a bug or feature report, so doesn't belong here).

#2 Updated by f ffierm over 6 years ago

First of all, thank You for the answer. If I follow your tips and I use the "single simbol" option the code I wrote works fine.

But, this is the problem, your "workaround" leave me surprised. My goal is to make a "categorized map" (and not a "single symbol" rendering). The "correct place" in which to put this function, maybe, is under "categorized" option (in my opinionit is a "logical problem").
Thanks.
Ciao,
francesco fiermonte

#3 Updated by Giovanni Manghi over 6 years ago

f ffierm wrote:

First of all, thank You for the answer. If I follow your tips and I use the "single simbol" option the code I wrote works fine.

But, this is the problem, your "workaround" leave me surprised. My goal is to make a "categorized map" (and not a "single symbol" rendering). The "correct place" in which to put this function, maybe, is under "categorized" option (in my opinionit is a "logical problem").
Thanks.

it is not a workaround, it is how it supposed to work in qgis.

#4 Updated by Regis Haubourg over 6 years ago

f ffierm wrote:

First of all, thank You for the answer. If I follow your tips and I use the "single simbol" option the code I wrote works fine.

But, this is the problem, your "workaround" leave me surprised. My goal is to make a "categorized map" (and not a "single symbol" rendering). The "correct place" in which to put this function, maybe, is under "categorized" option (in my opinionit is a "logical problem").
Thanks.
Ciao,
francesco fiermonte

Just to clarify things. Doing a category analysis must be simple for user. Using the category renderer and pointing the field to use is straightforward. It initiaze classes with pseudo random colors, and the a user can change it by hand.
Using CASE WHEN syntax is pretty advanced already, but you can do it if you want using data defined widgets available everywhere. I know no GIS tool asking you to type a CASE WHEN expression for a simple categorized map in first intention, but I know no other GIS tool than QGIS that allows you to do it if you really want to.

#5 Updated by f ffierm over 6 years ago

Dear Giovanni and Dear Regis,

first of all, excuse me for my trembling english and thank you for the answer.

@Giovanni: Maybe, in this case, QGIS seems to be "too much" free: in my opinion, a function that performs a "categorized output" shoud not be found onto a "single symbol" menu. It is a simple logical issue. If I'm wrong, can you help me describe it better in order to share your knowledge with our students? Thank you.

@Regis: I agree with you: a category analysis must be simple for the user. But, if a function exists, this tool must be properluy placed and never cannot give wrong results... If this is not a good way to go, the function should be "removed". If a student ask me: "what is the meaning of the function...?" I should search the correct way to answer and not speech about philosophy...

Thank to all for the cooperation.
Francesco.

Also available in: Atom PDF