Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

How to add a custom attribute to an existing .kml file


I have a proof-of-concept I'm trying to put together but am flailing a bit.


Here's what I want to achieve:


  1. Input tool: reading an existing .kml file
  2. Formula tool: add <color></color> attribute
  3. Formula tool: set color to green
  4. Output tool: save as .kml

I've created a .kml file with the following schema:


<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="">
<Schema name="TestLocations" id="TestLocations">
<SimpleField name="Name" type="string"></SimpleField>
<SimpleField name="Address" type="string"></SimpleField>
<SimpleField name="City" type="string"></SimpleField>
<SimpleField name="ST" type="string"></SimpleField>
<SimpleField name="Latitude" type="float"></SimpleField>
<SimpleField name="Longitude" type="float"></SimpleField>
<SimpleField name="Comments" type="string"></SimpleField>
<description>123 MAIN AVE</description>
<ExtendedData><SchemaData schemaUrl="#TestLocations">
<SimpleData name="Name">ABC123</SimpleData>
<SimpleData name="Address">123 MAIN AVE</SimpleData>
<SimpleData name="City">NEW YORK</SimpleData>
<SimpleData name="ST">NY</SimpleData>
<SimpleData name="Latitude">45.4133</SimpleData>
<SimpleData name="Longitude">-74.0794</SimpleData>
<SimpleData name="Comments"></SimpleData>

I recognize there needs to be a <color>green</color> attribute added after the <Placemark>. Before I get to this step, I've tried to read the file using a .csv format but get an error saying there are too many fields. So here's where I'm flailing. How do I read it, edit it, then save it?


My end goal is a .kml file which will be used in ESRI's ArcExplorer.


For reference, this is a sample Google .kml file:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="">
  <Style id="WhateverYouWantHere">
  <name>The Great Sphinx of Egypt</name>
  <description>The Great Sphinx of Egypt</description>


Thanks for the input in advance!



Hi @TR! I would try several things (in no particular order):

1) For the delimiters, use \0 (\0 means no delimiters)

2) For the field length, use a really big number (In case things are getting truncated)

3) Check the treat errors as warnings box (to at least try to read in as much as possible and allow debugging if there are still issues)




Once you get the data in, you could use a formula tool to add in the color attribute. For your output, you would use the same setup as the input. I'd be happy to help more, but I think you're on the right track!

Patrick Digan


Ahh, I overlooked my delimiter which was set as a comma. That one change worked perfectly, thanks!

Read .kml as .csv