Assign a specific color to vector layer based on RGB codes in attribute tableAssign multiple colors to features within a single vector layerPyQGIS: how to delete layer from TOC when attribute table is closed?Finding out and editing specific rows of attribute table in line shapefile using Python?How to save color VALUE to attribute table in QGIS for a vector layer with a graduated symbol rendererLine symbology based on a field for color AND size (linewidth)Fill in new field in attribute table based on the values of another field in GISTransfering vector Style classification into Attribute table in QGIS?Converting 8-bit RGB tif to single gray-scale imageHow to edit the attribute tabel of a shapefile when the enable editing is greyed out?Filter vector layer by searching through complete attribute table - limitations and improvements

What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?

Is there a nicer/politer/more positive alternative for "negates"?

How do you make your own symbol when Detexify fails?

Which was the first story featuring espers?

Why Shazam when there is already Superman?

A variation to the phrase "hanging over my shoulders"

How much of a Devil Fruit must be consumed to gain the power?

How much theory knowledge is actually used while playing?

What is the difference between lands and mana?

Non-trope happy ending?

How would you translate "more" for use as an interface button?

Does grappling negate Mirror Image?

What kind of floor tile is this?

Why is so much work done on numerical verification of the Riemann Hypothesis?

Which Article Helped Get Rid of Technobabble in RPGs?

How can ping know if my host is down

The Digit Triangles

Review your own paper in Mathematics

What to do when eye contact makes your coworker uncomfortable?

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

What is the English pronunciation of "pain au chocolat"?

How to explain what's wrong with this application of the chain rule?

Mimic lecturing on blackboard, facing audience

Taxes on Dividends in a Roth IRA



Assign a specific color to vector layer based on RGB codes in attribute table


Assign multiple colors to features within a single vector layerPyQGIS: how to delete layer from TOC when attribute table is closed?Finding out and editing specific rows of attribute table in line shapefile using Python?How to save color VALUE to attribute table in QGIS for a vector layer with a graduated symbol rendererLine symbology based on a field for color AND size (linewidth)Fill in new field in attribute table based on the values of another field in GISTransfering vector Style classification into Attribute table in QGIS?Converting 8-bit RGB tif to single gray-scale imageHow to edit the attribute tabel of a shapefile when the enable editing is greyed out?Filter vector layer by searching through complete attribute table - limitations and improvements













2















I use QGIS and have a geological map for a large area. I present this after ID codes based on the geology ("Geokartnr" in photo).



I want to use international/nation color codes for each rock type, this way it will be comparable to other peoples work. The international colors is already added to the attribute table as a RGB code ("RGBfargko"). Is there any way I can sort/present the maps by "geokartnr" code and present this by the color codes in the RGB codes in the attribute table? Or do I need to change all colors manually?



Screenshot of the attribute table










share|improve this question









New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

    – J.R
    14 hours ago











  • @J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

    – Oto Kaláb
    12 hours ago
















2















I use QGIS and have a geological map for a large area. I present this after ID codes based on the geology ("Geokartnr" in photo).



I want to use international/nation color codes for each rock type, this way it will be comparable to other peoples work. The international colors is already added to the attribute table as a RGB code ("RGBfargko"). Is there any way I can sort/present the maps by "geokartnr" code and present this by the color codes in the RGB codes in the attribute table? Or do I need to change all colors manually?



Screenshot of the attribute table










share|improve this question









New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

    – J.R
    14 hours ago











  • @J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

    – Oto Kaláb
    12 hours ago














2












2








2


1






I use QGIS and have a geological map for a large area. I present this after ID codes based on the geology ("Geokartnr" in photo).



I want to use international/nation color codes for each rock type, this way it will be comparable to other peoples work. The international colors is already added to the attribute table as a RGB code ("RGBfargko"). Is there any way I can sort/present the maps by "geokartnr" code and present this by the color codes in the RGB codes in the attribute table? Or do I need to change all colors manually?



Screenshot of the attribute table










share|improve this question









New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I use QGIS and have a geological map for a large area. I present this after ID codes based on the geology ("Geokartnr" in photo).



I want to use international/nation color codes for each rock type, this way it will be comparable to other peoples work. The international colors is already added to the attribute table as a RGB code ("RGBfargko"). Is there any way I can sort/present the maps by "geokartnr" code and present this by the color codes in the RGB codes in the attribute table? Or do I need to change all colors manually?



Screenshot of the attribute table







qgis attribute-table visualisation vector-layer






share|improve this question









New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 14 hours ago









Ian Turton

49.9k547115




49.9k547115






New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 14 hours ago









CasairoCasairo

112




112




New contributor




Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Casairo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

    – J.R
    14 hours ago











  • @J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

    – Oto Kaláb
    12 hours ago


















  • Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

    – J.R
    14 hours ago











  • @J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

    – Oto Kaláb
    12 hours ago

















Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

– J.R
14 hours ago





Be aware that by using an expression to set the color as stated answer below you wont be able to automatically generate a legend.... (so the problem is you either set the color manually OR create the legend manually....)

– J.R
14 hours ago













@J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

– Oto Kaláb
12 hours ago






@J.R Good point, I think its kind of bug, because I suppose that it will generate legend if you use Categorized symbology (with rgb field as category). You can manually change a symbol of every each category, but if the data defined values are set for color, the value is just not taken from the expression. Or I am missing something?

– Oto Kaláb
12 hours ago











3 Answers
3






active

oldest

votes


















3














In the layer styles panel if you click on simple marker, there is a small box to the right of the fill color combo box - if you click on it you can select edit from the menu and enter the expression editor.



enter image description here
You will need an expression like this, to convert your string's spaces to commas and then into a colour:



color_rgb( replace("rgbfargeko",' ',',')


Then click ok and your colors should show up.






share|improve this answer






























    2














    In the layer properties, in the symbology tab, define the color by an expression (link to the QGIS doc) :



    color_rgb(
    array_get(string_to_array("rgbfargko", ' '), 0),
    array_get(string_to_array("rgbfargko", ' '), 1),
    array_get(string_to_array("rgbfargko", ' '), 2)
    )


    Explanation of the code :



    1- function string_to_array : transform the field data into an array by splitting at the white space character ;
    2- function array_get : get elements of the array, the first item has an index of 0 ;
    3- function color_rgb : with 3 arguments (R, G, B), this function return a QGIS color.



    EDIT
    The solution of @Ian Turton is more visual and simple !






    share|improve this answer
































      2














      AS @J. Monticolo supposed, use Data defined expression in symbology properties.



      enter image description here



      For expression you can simply use:



      replace("rgbfargko",' ',',')


      Which takse "rgbfargko" string and replace spaces whit commas for proper color formatting. See:



      enter image description here



      enter image description here






      share|improve this answer






















        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "79"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        Casairo is a new contributor. Be nice, and check out our Code of Conduct.









        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316218%2fassign-a-specific-color-to-vector-layer-based-on-rgb-codes-in-attribute-table%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3














        In the layer styles panel if you click on simple marker, there is a small box to the right of the fill color combo box - if you click on it you can select edit from the menu and enter the expression editor.



        enter image description here
        You will need an expression like this, to convert your string's spaces to commas and then into a colour:



        color_rgb( replace("rgbfargeko",' ',',')


        Then click ok and your colors should show up.






        share|improve this answer



























          3














          In the layer styles panel if you click on simple marker, there is a small box to the right of the fill color combo box - if you click on it you can select edit from the menu and enter the expression editor.



          enter image description here
          You will need an expression like this, to convert your string's spaces to commas and then into a colour:



          color_rgb( replace("rgbfargeko",' ',',')


          Then click ok and your colors should show up.






          share|improve this answer

























            3












            3








            3







            In the layer styles panel if you click on simple marker, there is a small box to the right of the fill color combo box - if you click on it you can select edit from the menu and enter the expression editor.



            enter image description here
            You will need an expression like this, to convert your string's spaces to commas and then into a colour:



            color_rgb( replace("rgbfargeko",' ',',')


            Then click ok and your colors should show up.






            share|improve this answer













            In the layer styles panel if you click on simple marker, there is a small box to the right of the fill color combo box - if you click on it you can select edit from the menu and enter the expression editor.



            enter image description here
            You will need an expression like this, to convert your string's spaces to commas and then into a colour:



            color_rgb( replace("rgbfargeko",' ',',')


            Then click ok and your colors should show up.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 14 hours ago









            Ian TurtonIan Turton

            49.9k547115




            49.9k547115























                2














                In the layer properties, in the symbology tab, define the color by an expression (link to the QGIS doc) :



                color_rgb(
                array_get(string_to_array("rgbfargko", ' '), 0),
                array_get(string_to_array("rgbfargko", ' '), 1),
                array_get(string_to_array("rgbfargko", ' '), 2)
                )


                Explanation of the code :



                1- function string_to_array : transform the field data into an array by splitting at the white space character ;
                2- function array_get : get elements of the array, the first item has an index of 0 ;
                3- function color_rgb : with 3 arguments (R, G, B), this function return a QGIS color.



                EDIT
                The solution of @Ian Turton is more visual and simple !






                share|improve this answer





























                  2














                  In the layer properties, in the symbology tab, define the color by an expression (link to the QGIS doc) :



                  color_rgb(
                  array_get(string_to_array("rgbfargko", ' '), 0),
                  array_get(string_to_array("rgbfargko", ' '), 1),
                  array_get(string_to_array("rgbfargko", ' '), 2)
                  )


                  Explanation of the code :



                  1- function string_to_array : transform the field data into an array by splitting at the white space character ;
                  2- function array_get : get elements of the array, the first item has an index of 0 ;
                  3- function color_rgb : with 3 arguments (R, G, B), this function return a QGIS color.



                  EDIT
                  The solution of @Ian Turton is more visual and simple !






                  share|improve this answer



























                    2












                    2








                    2







                    In the layer properties, in the symbology tab, define the color by an expression (link to the QGIS doc) :



                    color_rgb(
                    array_get(string_to_array("rgbfargko", ' '), 0),
                    array_get(string_to_array("rgbfargko", ' '), 1),
                    array_get(string_to_array("rgbfargko", ' '), 2)
                    )


                    Explanation of the code :



                    1- function string_to_array : transform the field data into an array by splitting at the white space character ;
                    2- function array_get : get elements of the array, the first item has an index of 0 ;
                    3- function color_rgb : with 3 arguments (R, G, B), this function return a QGIS color.



                    EDIT
                    The solution of @Ian Turton is more visual and simple !






                    share|improve this answer















                    In the layer properties, in the symbology tab, define the color by an expression (link to the QGIS doc) :



                    color_rgb(
                    array_get(string_to_array("rgbfargko", ' '), 0),
                    array_get(string_to_array("rgbfargko", ' '), 1),
                    array_get(string_to_array("rgbfargko", ' '), 2)
                    )


                    Explanation of the code :



                    1- function string_to_array : transform the field data into an array by splitting at the white space character ;
                    2- function array_get : get elements of the array, the first item has an index of 0 ;
                    3- function color_rgb : with 3 arguments (R, G, B), this function return a QGIS color.



                    EDIT
                    The solution of @Ian Turton is more visual and simple !







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 14 hours ago

























                    answered 14 hours ago









                    J. MonticoloJ. Monticolo

                    1,155217




                    1,155217





















                        2














                        AS @J. Monticolo supposed, use Data defined expression in symbology properties.



                        enter image description here



                        For expression you can simply use:



                        replace("rgbfargko",' ',',')


                        Which takse "rgbfargko" string and replace spaces whit commas for proper color formatting. See:



                        enter image description here



                        enter image description here






                        share|improve this answer



























                          2














                          AS @J. Monticolo supposed, use Data defined expression in symbology properties.



                          enter image description here



                          For expression you can simply use:



                          replace("rgbfargko",' ',',')


                          Which takse "rgbfargko" string and replace spaces whit commas for proper color formatting. See:



                          enter image description here



                          enter image description here






                          share|improve this answer

























                            2












                            2








                            2







                            AS @J. Monticolo supposed, use Data defined expression in symbology properties.



                            enter image description here



                            For expression you can simply use:



                            replace("rgbfargko",' ',',')


                            Which takse "rgbfargko" string and replace spaces whit commas for proper color formatting. See:



                            enter image description here



                            enter image description here






                            share|improve this answer













                            AS @J. Monticolo supposed, use Data defined expression in symbology properties.



                            enter image description here



                            For expression you can simply use:



                            replace("rgbfargko",' ',',')


                            Which takse "rgbfargko" string and replace spaces whit commas for proper color formatting. See:



                            enter image description here



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 13 hours ago









                            Oto KalábOto Kaláb

                            4,08231431




                            4,08231431




















                                Casairo is a new contributor. Be nice, and check out our Code of Conduct.









                                draft saved

                                draft discarded


















                                Casairo is a new contributor. Be nice, and check out our Code of Conduct.












                                Casairo is a new contributor. Be nice, and check out our Code of Conduct.











                                Casairo is a new contributor. Be nice, and check out our Code of Conduct.














                                Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316218%2fassign-a-specific-color-to-vector-layer-based-on-rgb-codes-in-attribute-table%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                                용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                                155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해