Select to view content in your preferred language

Layer's Display Expression still not supported?

825
2
01-22-2014 11:18 AM
Emilbrundage
New Contributor III
I'm working on a script that creates KMLs. It would be nice if it could set the display expression. After a little digging I came across a post that stated setting a layer's display expression is not yet supported by arcpy. Does anyone know if this is (still) true?

Thanks!
Tags (2)
0 Kudos
2 Replies
JeffBarrette
Esri Regular Contributor
It is not in the arcpy.mapping API.  It was never a requirement for map automation.  Perhaps this is something we can consider for a future release.  Please put it on the ideas web site (http://ideas.arcgis.com/).

A possible work-around would be using comtypes - a Python module that provides access to ArcObjects from Python.

Jeff
0 Kudos
Emilbrundage
New Contributor III
Update:

I found a work-around for this. I'm lucky in that the field that is automatically chosen as the display field (in my case, "Name") does not actually contain any useful data. Thus I can calculate this field with what I want for the KMZ.

Worth noting is that I initially tried deleting the "Name" field and adding a new field that ArcMap would select as the display field. My desired field is called "P6_NBR", so I instead went with it "NAMEP6_NBR". ArcMap looks for a field with the word "Name" in it to use as its default display field. This did not work however for the KMZ creation. Even though when I check the layer's display field post-script running it shows "NAMEP6_NBR", for whatever reason the KMZ created by my script does not use this field and instead shows [no name] or something like that.
0 Kudos