1

I have a map template with header bar with a text element on top of it. I'm producing multiple maps and I want the header bar (drawn rectangle) to change color based on the type of map.

The drawn rectangle at the top of the map is not associated with any layers, but it has a element tag, so I should be able to call it out in Python and define what fill color I want it to be.

Does anyone know if this is possible?

For use in ArcMap 10.5. After some research, this is the closest I can materialize. The last line would be something like "elm.change color to something"

for elm in arcpy.mapping.ListLayoutElements(mxd, "MAPSURROUND_ELEMENT"):
    if elm.name == "Box":
        elm.???
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Dave
  • 553
  • 2
  • 15

2 Answers2

1

As far as I'm aware it isn't possible. You can refer this post Changing color of symbol in UniqueValuesSymbology object using ArcPy?

The only thing in terms of documentation that may be relevant from Esri on this is Fill symbol layers are components of symbols

I've heard of using ArcObjects as a workaround, however more than that I'm not aware.

whyzar
  • 12,053
  • 23
  • 38
  • 72
0

You cannot change the color of a MapsurroundElement - or of any other layout element or graphics - with arcpy, you would need ArcObjects to do that (see here the properties of MapsurroundElement you can access with arcpy).

As a workaround, you can create copies of your box, each with a different color and name, that you place outside of the layout in your template. Depending on the type of map you are creating, you will call one particular box and move it to the appropriate location on your page (by modifying their elementPositionX and elementPositionY properties). Make sure the anchor point is the same for all boxes, but this should be the case if you just copy/paste them.

This is not the cleanest solution you could dream of, but it's easy to implement and will work .

GISGe
  • 9,674
  • 19
  • 41
  • Thanks for the workaround, but it's not a viable one. The maps I'm creating are from an automation script, so there will be no manually moving of boxes. I found a solution, however. – Dave Jan 04 '18 at 14:19
  • 1
    can you post your solution then – NULL.Dude Jan 04 '18 at 14:24