1

I have a single layer that is divided up into "sub-layers" (there is only 1 layer). The "sub-layers" are shown in the Layers Panel with different names and colors based on location. I would like to group these "sub-layers" together based on their name (the way I am grouping them doesn't really matters) what matters is how I can group a single layer into groups. I would like to group these Lines below by "AK" or "AL" (again the specifics are not important). I cannot select any of these options (AK - North Slope), for lack of a better word, drag and drop does not work.

One Layer split by colors

Any suggestions would be great.

I tried following information found here and here but these resources are specifically talking about multiple layers while I am working with a single layer.

I also found similar questions and this one but again they are dealing with multiple layers.

I am trying to do this using the GUI first and then through a Python script so any information you can provide will be really helpful

I am using QGIS 2.4, Postgresql 9.6, and Python 2.x

1

So you have a style set by category, which creates an entry in the legend for every different name.

To group them by part of the name, you can change the way the entries are categorized. Instead of grouping by name, it would be by left(name,2) to use only the first two letters. Doing so would assign the same color to all entries having the same first two letters (so all AK entries in green etc).

enter image description here

If you want to preserve the distinct colors, you would have to copy/paste the layer several times - one by state - and to filter the data to display only the corresponding lines (so the AK layer shows only AK data). You could then expand or not the legend to show individual records.

  • I would like to maintain the unique colors in each grouping. However I tried changing column to left(Name, 2) and this does not work, I am overwriting the value I have in the column field. I don't fully understand what you are saying for keeping everything different colors. – Ely Fialkoff Aug 30 '18 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.