Ask A Cartographer

placing color swatch values in BLOB field

November 23 2011 | 8 comments
Categories: Cartographic Representations

The ArcGIS help (http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//008t00000078000000.htm) indicates that for representations you can use data fields to specify various rule properties. It indicates the different data types that can be associated with properties. It indicates that color swatch properties can be associated with BLOB fields.

My question is this: how do you enter color swatch data into a BLOB field that could then be used by the representation rules?

Since these are binary fields, it is necessary to a) know the color swatch binary format (which could easily be text, but still needs to be known), b) be able to populate the BLOB field with the appropriate raw data. I cannot find any examples of how to do this in help, forums, etc. So, at this point I seem to have a help system that tells me that I can use color swatch BLOB fields but does not tell me any way to actually create color swatch BLOB fields. This is somewhat less than helpful.

Any thoughts, directions or ideas on how to do this? Thanks.

Mapping Center Answer:

The blob field will simply contain a serialized ArcObjects color object, so you will not see the color patch itself and the "value" itself will be "Blob".

The way works is:

  • Create a blob type field.
  • Associate it to a representation color property.
  • When changing the color for that particular feature, the color will be stored in the field.

So, first add a field to the attribute table of the feature class that has reps and that you want to have the color swatch values read from. You might call the new field "Color"; set the field type to "Blob". Before closing the attribute table, click the Open the layer properties for the reps feature class you just added the field to, and on the Symbology tab, click the Table Options tool and select Turn all fields on. Close the attribute table.

Open the Layer properties dialog for the reps reature class and on the Symbology tab, with Representations chosen under the Show option, click the Display field overrides tool at the bottom of the area that shows the symbology features (it looks like a gray database can). Now click teh grop down for the Color of the symbol and select the field that you added (e.g., "Color) as the field from which to draw the color definition that will override the default.

Then start and edit session, and select the feature that you want to be a different color than the default. On the Representations toolbar click Representation Properties tool (at the far right). Select a feature for which you want to change the color. In the Representation Properties area, click on the color and select or define (by clicking More Colors) the color you want to use instead.

When you save your edits, that new color will be saved in the field you added ("Color") and will be used when the feature is drawn. It will still appear as "Blob" if you look at the attribute table.

An idea would be to have the override field also support Text types, then you could have the field value stored as something like "RGB-097-223-256" with the color definition clearly apparent.  You could suggest something like this on the ArcGIS Ideas page so that the development team sees your idea -- here is a link from our site to that page: http://mappingcenter.esri.com/index.cfm?fa=ask.gateway&activeTab=4

To prepare your data outside of the editing environment, you’d have to write some code.

thanks, but what I was hoping for... posted by Brian Merson on Dec 4 2011 5:46PM
Thanks for the answer. As I understand it, this procedure would allow you to override colors on an individual basis. You are defining a color blob field, which is initially uninitialized. Then you select the unintinialized field as the override field for a color associated with a representation rule layer (e.g., a fill color). At this point, there is no color in the color field. You then start an edit session, select a specific representation, and set its color. When you save your edits, the new color will be placed in the corresponding color blob field. Right?

What I was hoping to be able to do was to initialize the color blob attribute field directly in some way (e.g., a Python script), calculating and filling in my desired colors. Is that something that is possible?

In terms of your procedure, is there a way to select representation features by an associated attribute? For example, say I have a representation rule that creates blue circles for items with an associated value < 100. Now, during my edit session I would like (theoretically) to select all of the representation features on my map that use this rule. Can I do that? If so, how?

Follow up... having selected multiple representation features during my edit session, can I then change an associated color property, save and have the new color stored as an override in the color blob attribute of all of the selected features?
feature suggestion posted by Brian Merson on Dec 4 2011 6:13PM
I added the text field override idea as a feature request.
Thanks! posted by Aileen Buckley on Dec 5 2011 1:13PM
Thanks for adding the suggestion on the ArcGIS Ideas page!
Editing the color blob field posted by Aileen Buckley on Dec 5 2011 8:28PM
As long as the selected features use the same representation rule, the editing user interface will allow you to update all the selected representations at once. The selection can of course be obtained by whatever selection mechanism in ArcGIS.

If you happen to know how to populate a blob with a serialized ArcObject color, the python script approach would also work. This would still be a lot easier with a string field, so again, thanks for your suggestion about that.
example of color serialization? posted by Brian Merson on Dec 6 2011 5:03AM
I'm reasonably comfortable with Python, but haven't had any direct experience with ArcObjects. Does anybody know of any Python examples of serializing an ArcObject color object (RgbColor, I think). Since ArcObjects appear to be COM-based, I assume that the process would be the same for any object that implements the appropriate serialization interface. However, I identified at least 2 or 3 that are possible, so an example would be very helpful. Also, I didn't see any Python examples for accessing ArcObjects, just examples for compiled languages and VBA. Again, some kind of Python examples would be extremely helpful. If anybody has ideas of where such examples might be located, it would be great. Thanks.
Contact Tech Support posted by Aileen Buckley on Dec 7 2011 12:05PM
This is something that our Technical Support team should be abel to help you with. You can get to them through this link on Mapping Center: http://mappingcenter.esri.com/index.cfm?fa=ask.gateway&activeTab=3
example of color serialization posted by Mark Wigley on Aug 20 2012 12:13AM
Hallo Brian,
Did you get an answer as how to steer this using Python? If yes I would be very interested to receive the solution as well.
No python answers yet posted by Brian Merson on Aug 20 2012 5:11AM
@Mark...

Unfortunately, no. I'm actually a grad student and working with the school's copy of ArcGIS. As a result, I was unable to get any assistance from Tech Support (not being an actual registered product owner). Mildly annoying. If you are a registered owner of ArcGIS, perhaps you or some other registered owner might want to pursue this with tech support as suggested above. I would love to know the answer (and I'm still hoping they'll add the text color property feature, as I think it would be a simpler and more useful approach). Anyway, please post any updates here. Thanks.

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |