Importing KML Description data in Cartographica


Those of you importing KML data files may have been surprised when the Description comes in with all sorts of "field data" that you think might belong in columns. Unfortunately, there are a number of different ways to represent actual field data in KML and seeing only the Description and Name fields imported by Cartographica is an excellent sign that the maker of the KML file didn't use any of them. However, we have an AppleScript you can use to mine that data inside of Cartographica.

For those unfamiliar with AppleScript, we had some more in-depth commentary on it in our Advanced label techniques in Cartographica article from late last year.

To solve this particular problem, we are going to use AppleScript to locate the Description field and split it up into component parts, making each colon-prefixed element a new column.

The Technique

We are using AppleScript to access the front-most Cartographica document and then spin through each feature in a particular layer, extracting the individual pieces of data from the Description field and saving them to their own column. The script is available for download from our ClueTrust servers.

The script can perform changes on multiple layers during the same execution, which means you can load up multiple KML layers and then go have a coffee after starting the script.


← The Modifiable Areal Unit Problem in GIS | Come visit us at AAG 2011! →
More in Automation
← Summarizing Point Data on a Polygon Layer | AppleScript changes in 1.2.2 →