Python - ArcGIS 10 Desktop Symbology - Label Color = Unique Values Symbology Color

1798
6
10-04-2011 02:00 PM
SchoppMatthieu
New Contributor III
Hello,

I'm looking for a bit of help with this:

I've got a polyline feature that contains hundreds of data.
I symbolized the data using "Categories" �?? "Unique values".

How can I make the labels color matching the polylines symbols color ?

I found a script on the forum to achieve that but it's made with VBA.

Did anyone solve this problem using Python Script ?

Cheers
Tags (2)
0 Kudos
6 Replies
MikeMacRae
Occasional Contributor III
I don't believe this is available. ESRI doesn't give control over that portion of the properties dialogue box via python yet. I was looking into this last week and came across a blog somewhere that suggested it may be available in 10.1. If you find a way to do this, please post.

Mike
0 Kudos
SchoppMatthieu
New Contributor III
Thank you Mike,

Did anyone else try to achieve this ?

Thanks,
0 Kudos
JeffBarrette
Esri Regular Contributor
I'm not sure you can even do this in the user interface.  But once you have all your label symbol colors matching the line symbol colors you could save the results to a layer file.  With arcpy.mapping you can update the symbology of other layers in other map documents or layer files using the UpdateLayer function.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/UpdateLayer/00s30000003p000000/

This scenario will not be possible with 10.1 using arcpy.  At 10.1 we've introduced a limited set of symbology renderers to the arcpy.mapping API (e.g., Raster Classified).  With these new classess you can change the number of classes, change min/max values, class break values, etc.  There is nothing in the new API that allows you to change label symbols.

Jeff
0 Kudos
AlessandroCinnirella
New Contributor III
use
symbologyLayer = "path/to/the/lyr/with/the/symbology/you/like.lyr"
lyr = your layer
arcpy.ApplySymbologyFromLayer_management (lyr, symbologyLayer)


you can find the documentation here



ciao,
AC
0 Kudos
JeffBarrette
Esri Regular Contributor
arcpy.ApplySymbologyFromLayer is very similar to arcpy.mapping.UpdateLayer (with more options than just symbology).

As mentioned above, you still need to author a layer file ahead of time - there is no way to automate the symbology changes.

Jeff
0 Kudos
SchoppMatthieu
New Contributor III
Hi,

So finally it is possible to achieve this using VBA (that means to install VBA and get an authorization file from Esri).
Then the piece of code mentioned above in the first post works fine.

I'm a bit worried that Esri replace VBA by Python if the Python Library is not at least at the same level of completion than the VBA one.
0 Kudos