Global Mapper v25.0

Color Values for Styles

curtcarto
curtcarto Global Mapper User
Could some kind soul help me make sense of the RGB/24-bit color values used in the Point/Line/Area styles?

Now, I realize that I have to use RGB values in the Color dialog box.

What I want to do is make a text file to automate the process (and keep it to use it again in the future)...

But I can't make sense of the color scheme when I save a test sample to text file.

Example:
If I have stream data and I want to color them based on stream flow (which is in the data).
So, I can use the "flow" field as the "Attribute/Name to Base Style On" in the Vector Options window.
But when I have to create, say, 10 classes of stream/flow, I would like to optimize the process.
I'd like to make a text file with incrementally darker colors as the flow gets bigger. (Instead of having to manually add 10 classes. ArcMap does this sort of thing very easily. Just tell it what field, how many classes and what color ramp to use to style the 'symbology'.)
Class 1 (small) would be say the RGB equivalent of 10% cyan
Class 10 (big) would be the equivalent of 80%cyan.

AttrLineStyle=65282, 2097152, 0.0 is a Blue (RGB 255,0,0) line.

So, how do I convert RGB values (or even better CYMK values) to this apparently 24-bit value? How is that 65282 from the example above generated?

Help?

Thanks,
.curt

Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Those line styles are not meant to be edited by hand. Your best bet is to use the Init from Values... button on the Line Styles tab. After you pick the initial color, Global Mapper will offer you the chance to create an initial set of colors using the minimum, maximum, and average values, and it will interpolate colors in between (you can change that behavior.) If you want to use additional values, you will need to add them one at a time to the list. Once you have created the list, you can save it to a file for later use.

    We currently have an open feature request to improve this process. I have added your suggestion to the item, and we will post back to this thread when its status changes.
  • curtcarto
    curtcarto Global Mapper User
    Bob, thanks for the prompt response.

    But honestly, it comes up short. My dataset has over three millions objects/features. It's all of the streams/rivers in the US. It's big. I can't Init from Values for that many features.

    The Max/Min doesn't help because it doesn't let me generate the class breaks where I want them. GM is so much faster than ArcMap 10.2 in so many ways, but creating classes and styles...ugh.

    I realize that controlling how vectors are styled in GM is a requested feature, but there's this other feature that already exists.

    GM has the ability to load and save those styles. If you save it, it's easily opened and changed.

    I don't mind using a text editor to make up the class styles. It's faster than entering value and style of for each one.

    I just want to know how those numbers are generated. Mike tried to explain it in an email awhile ago, but his response was understandably quick. I didn't understand what values GM is using.

    Even if I know you're using xyz standard, I can research that on my own. I just need pointed in the right direction.

    Thanks,
    .curt
  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User
    Curt,

    If you supply just a couple of numeric values for the attribute styles, then the color and line width will be interpolated based on which range the value is in (if you check to interpolate). So if you say want 0.0 to be fully blue (0,0,255) and 10 to be say red (255,0,0), just add an attribute/style value at 0 with blue as the color and at 10 with red and the color and width will interpolate for values in between. You can add different in between values to adjust the ranges as desired, but I'm guessing you just need a couple.

    Often for stream flow I will use line width more than color, so low flow is just a single pixel wide line, while large flows end up with a much thicker (5 or more pixels) line. Since the line width interpolates as well it is very easy to just assign a low and high flow value and maybe one more in between to get a very nice display from the flow attribute.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User
    Answer ✓
    Curt,

    I can also give you a bit of help with the formatting of those style strings, but they are tough to do by hand as they are packed bit fields. For example, that first number is actually a 32-bit value, with the upper 24-bits being the color and the lower 8 bits containing other bit values. Here is the breakdown of bits:

    Bits 0-3: lower 4 bits of line width (if not fixed width). If width is > 15, additional bits from other fields are added on.
    Bits 4-6: lower 3 bits of style flag. Style enumerations larger than 7 use additional bits in other fields
    Bit 7: should we not draw the label for this line?
    Bits 8-15: blue (i.e. raw blue * 256)
    Bits 16-23: green (i.e. raw green * 65536)
    Bits 24-31: red (i.e. raw red * 1667216)

    For example, your 65282 value above looks like 0x0000FF02 in hex. The top 24 bits are color, so you get 0x0000FF, or RGB(0,0,255), for the color blue. The 0x02 at the bottom mean the line width is 2 pixels and the style is 0, which is solid.

    The 2097152 is the extra bit of flags. Looks like a weird number, but in hex is 0x00200000, so really it's just one bit set for a particular flag at bit 21. In the extra flags that bit means that whether or not the label should draw for the line is based on the label setting for the line classification and not bit 7 in the normal flags. Typically you will just always use 2097152 for the extra flags unless you are using a fancy line style or very wide lines.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • curtcarto
    curtcarto Global Mapper User
    Thanks, Mike. That's a mouthful, but I'll see if I can unpack it and make sense of it all.
  • bmg_bob
    bmg_bob Global Mapper Programmer
    edited August 2015
    In the line AttrLineStyle=65282, 2097152, 0.0, the initial value (65282) contains the color and the width. The value is calculated from an RGB value as:

    width + (256 * Blue) + (256 * 256 * Green) + (256 * 256 * 256 * Red)

    In your example, width is 2 and Blue is 255, so 2 + (256 * 255) = 65282.

    The other values represent other information to Global Mapper, but you shouldn't need to calculate those. You should be able to set up the style with the options you want and a single color in the list, and then export that file to get a starting point. Each entry is represented by 3 lines, AttrVal, AttrLineStyle, and AttrFont, so you should add an additional group of 3 lines for each class, updating the AttrVal and AttrLineStyle as necessary.
  • curtcarto
    curtcarto Global Mapper User
    Hey Bob,
    Awesome. Thanks!

    In the formula ...(256*Blue)...

    The 256 is always 256.
    And Blue (or Red or Green) is the RGB value of the blue I had (ex 255)?

    So a 1 pixel line of RGB 0,0,255 (blue) would be
    1 + (256 * 255) + (256 * 256 * 0) + (256 * 256 * 0) = 65281
    1 +(65280) + 0 + 0 = 65281 ?

    The rest of the attributes, I'm not as worried about, but being able to visualize the hierarchy of the streams is important.

    Thanks for helping again!!
    .curt


  • bmg_bob
    bmg_bob Global Mapper Programmer

    The 256 is always 256.
    And Blue (or Red or Green) is the RGB value of the blue I had (ex 255)?

    So a 1 pixel line of RGB 0,0,255 (blue) would be
    1 + (256 * 255) + (256 * 256 * 0) + (256 * 256 * 256 * 0) = 65281
    1 +(65280) + 0 + 0 = 65281 ?
    You are right. Note that I made a small correction (in bold) to your example.
  • curtcarto
    curtcarto Global Mapper User
    Yes, good catch!

    It's sinking in!

    Thanks for your time, guys!!