0

So I have this point layer that has 2 columns that I need styled, one of which is owner_id and the other is size. Both are integer fields if it matters. The owner_id matches with an owner name in another table

The intended outcome is to have all 300 owners with names(instead of ids) to be listed by color, and for each owner a range of sizes to be styled by dot size. Essentially it would look like

**owner1name** green
size <5  green small
size 5-25 green medium
size >25 green big
**owner2name** blue
size <5 blue small
size 5-25 blue medium
size >25 blue big

Now I can do categorized style on the owner, switch to rule based and then add ranges but there are 2 problems with this approach

1 - Resulting ranges all take the same color instead of random ones

2 - If people toggle an owner on but untoggle one of the sizes, using the selection tool will also pick the untoggled combination

3 - Owners are listed by id, not name

What is the best way of tackling this?

  • 4
    I wonder if this is a good approach to representing the data. 900 combination will be very hard to understand and 300 colours will result in shades so close to each other that confusion is highly likely. Can I suggest you rethink your approach, perhaps by having a numeric or alphanumeric label for an owner and a point size/colour for your size attribute? – MappaGnosis Jan 17 at 10:22
  • Labels won't work because the map will be absolutely cluttered. Has to be color plus size. People will toggle a few owners at one point but never more than 10. but good point about names. I'll add to the OP – Luffydude Jan 17 at 11:58
  • You could add a layer to the point symbol, with a text marker for the initial of the owner's last name. If the legend is alphabetized that would make it easier to find a specific owner. – csk Jan 22 at 18:24
1

This method allows you to toggle individual land owners. Basically this is the reverse of the first method I suggested.

Use categorized styling to control the color.

enter image description here

Use data-defined styling to control the point size.

enter image description here

CASE 
    WHEN "size" <5  THEN 1
    WHEN "size" >5 AND "size" <25  THEN 2
    WHEN "size" >25  THEN 3
    ELSE 0
END

In the example expression, small points would be 1 mm, medium will be 2 mm, large will be 3 mm. Change these values to suit your needs. To change the units, select a different unit from the dropdown menu in the style manager.

  • It's a better solution, thanks. I still had to enter 330 names manually tho – Luffydude Jan 23 at 11:08
  • There's no need to enter the names manually if they're stored as attributes. In the Categorized style menu, choose the "owner" column name from the dropdown, then click "Classify". The program automatically creates a category for each unique values in that field. – csk Jan 23 at 17:19
  • there was an owner id that links to another table that had the name – Luffydude Jan 24 at 15:56
2

Use a graduated style to control point size.

enter image description here

Use the following expression in data-defined settings to assign a unique color to each landowner. Substitute the actual value where it says "[total number of landowners]".

ramp_color('Spectral',"owner_ID"/[total number of landowners])

enter image description here

I used the ramp_color() function to choose a color from the Spectral color ramp. You can use a different color ramp if you want, but with 300 landowners I think you'll want as many different colors as possible.

The ramp_color function takes two parameters (quoted from the expression description):

ramp_name: the name of the color ramp as a string, for example 'Spectral'

Color ramp names vary between QGIS installations, so be sure to use the name of a color ramp that you have available in your QGIS installation.

value: the position on the ramp to select the color from as a real number between 0 and 1

I assumed that the range of values for the "owner_id" field is from 1 to the total number of owners. If that's not the case, adjust the expression so that it gives a value between 0 and 1. You can also write a more complicated expression if you want the colors distributed differently between the landowners.

  • This approach looks neat but has one obvious problem: I can't toggle owners on and off. People need to toggle only a few owners at a time otherwise it's a complete chaos – Luffydude Jan 22 at 16:00
  • Reversing this is pretty simple; see my other answer. – csk Jan 22 at 17:39

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.