Area Styles fill color from RGB values e.g. RGB(0,0,255)

Hi,

Does anyone know how to use the RGB values as fill colours when defining Area Styles? I have the values e.g. RGB(0,0,255) and they are saved to an attribute column called FILL_COLOR. I have tried exporting the data to shapefile and reimporting as suggested in another post but it does not use the fill values when imported back in. 

I have tried applying the styling based on the FILL_COLOR but is assigns a random colour instead.

Any help would be appreciated.

Cheers,
Steve


rgb.jpg 67.4K

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,141
    Answer ✓
    Hello Steve,

    When you apply a style based on an attribute value, Global Mapper simply treats the attribute values as strings, and does not attempt to parse out colors, so that will not work as you want it to.  When you load a shapefile, if there is an attribute called FILL_COLOR on an area feature, Global Mapper should use that color.

    Can you post a zip archive containing the shapefile that contains the FILL_COLOR attribute?

    Cheers,
    Bob

Answers

  • sphillipssphillips Posts: 192
    Just figured it out. I just needed to change my FILL_STYLE values to Solid instead of No Fill. After exporting to shapefile and re-importing my area features were automatically filled with my RGB values.

    As background info, I had a DWG with coloured polygons. I needed to created a KMZ with the polygons filled with the same colours used for the borders in the original CAD drawing.

    If anyone needs this to do this my workflow is as follows:

    1. Select the features
    2. Right-click > Attribute/Style Functions > Add Style Attributes to Selected Features to generate the BORDER_COLOR VALUES.
    3. Right-click the layer > Layer > Calculate/Copy Attribute Value(s) to copy the BORDER_COLOR RGB values to a new FILL_COLOR attribute column.
    4. Edit the FILL_STYLE attribute values to change them from No Fill to Solid
    5. Export to shapefile
    6. Import back in (the Area Styles will automatically come in with the RGB values applied as solid fills.
  • sphillipssphillips Posts: 192
    bmg_bob said:
    Hello Steve,

    When you apply a style based on an attribute value, Global Mapper simply treats the attribute values as strings, and does not attempt to parse out colors, so that will not work as you want it to.  When you load a shapefile, if there is an attribute called FILL_COLOR on an area feature, Global Mapper should use that color.

    Can you post a zip archive containing the shapefile that contains the FILL_COLOR attribute?

    Cheers,
    Bob
    Thanks for your reply Bob - all under control now. Looks like we posted at similar times so you probably didn't see my post. Changing the FILL_STYLE to Solid fixed the problem for me.

    Cheers,
    Steve
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,141
    Hello Steve,

    You are correct. I did not see your post. I'm glad to hear that you worked it out. 

    Cheers,
    Bob
Sign In or Register to comment.