Select to view content in your preferred language

Map to KML display expression

548
2
11-12-2013 08:44 AM
MattEiben
Deactivated User
I'm trying to streamline a already working tool with better display functionality through Arcpy.  I'm assigning labels to ArcMap using Arc formatting tags such as <CLR>, <BOL>, and <ITA>.  The problem I'm having is that these styles work great within ArcMap, by apparently aren't embedded deep enough into the software. 

An example of a display expression: "<BOL><CLR red='255' green='255' blue='255'>" + [Field1] + "</CLR></BOL>"

When the Map is exported to a KMZ through the "Map to KML" tool, the Arc formatting tags are inserted directly into the <name></name> KML tags and displayed as straight text in the KMZ labels.  However, when you actually use the color drop downs inside Arc instead of using the formatting display tags, the KMZ labels reflect that change.

From my understanding, ArcMap takes these formatting tags and displays the text dynamically through the software.  My question is this:
Is there a way to apply the formatting deep enough in ArcMap for the change to reflect through the Map to KML tool.  Ideally, the formatting would be applied through a python Arcpy tool.  The whole point is to not need a person to actually go into the menu and manually set the font as desired.

I suspect this functionality just isn't built into ArcMap, but it'd be nice to know,
Thanks!
0 Kudos
2 Replies
MattSayler
Frequent Contributor
KML is an XML-based specification. It has some specific tags for styling features, but I don't think it has any for labels. Might be able to use HTML (looks like it works for stuff in <description>, not sure about <name>). That technically might come down to what's interpreting the KML though. I.e. ArcMap will probably show the html tags as text and Google Maps might interpret them.

Before diving too far down the rabbit hole on options, what's the usage scenario for the KML?

KML Reference Doc if you're interested:
https://developers.google.com/kml/documentation/kmlreference
0 Kudos
MattEiben
Deactivated User
I know it's been a while since this thread was posted, but in case any others have a similar problem, here's my solution:

Formatting the labels on screen using the built in XML Fonts isn't embedded deep enough in the program to propagate into the map to KML tool.

My solution utilized a brute force approach.  I had the script dig into the KMZ file using the zipfile module and manually replace the font colors in the unzipped KML using regular expressions.

Never a very pretty solution, but it gets the job done.
0 Kudos