In Arcmap I've created a complex label expression in the Display expression for my layer. I'd like to have that expression displayed when I convert the layer to .kmz file for display in Google Earth. I'm using the ESRI Layer TO KML conversion tool.
What happens in the popup right now is the display expression jammed, without the correct formatting, into the feature name box and also the feature description box, followed by the complete list of fields.
I've been looking at the HTML popup tab, but don't see any way to use the Display Expression I already have in that tab. Is it possible for this to happen? It looks like otherwise I'll have to write a XSL template.
EDIT: Thanks to @KHibma for the comment. What I've ended up doing is
- removing all of the fields from display in the shapefile properties in ArcMap before the export so they are not included in the kml popup
- Labeling the features in arcmap with one field so that field value is the "title" of the feature in the popup.
- adding HTML formatting tags to the Display Expression (which I was writing in Python). this expression appeared, formatted, in the blue box below the feature title.
I can't add a screenshot of the result right now, but will be able add it later.
This worked fine on a small scale, but when trying to export an entire parcel fabric for a county I would get a C++ runtime error.
One interesting thing I found was that, even before the export, if there was an error in the FindLabel function and it was not able to create a label, it would come back as empty. So I added a try/except statement within the function like:
def FindLabel([field1],[field2]): try: #code for function except: return "there was a problem creating this display"
which worked great. However, when I tried to import sys or traceback in the function and set the error handling message as the return in the except statement, it still returned blank (i.e. didn't return the text of the error handling message). In the end, I fixed all the problems with the expression, but still got the runtime error when making the big export.