Color Coding Script

Sam Koshy was ambitious enough to write a Python script that will colorize the points in a KML file with respect to altitude as shown here: If you’re interested in having your data color coded like this, you can follow these simple steps:Screen Shot 2014-07-11 at 9.27.54 PM

  1. Download and unzip the python script that Sam wrote: http://s4.sonoma.edu/wp-content/uploads/2014/07/Colorpy.zip
  2. Use the S4 Data Manager to export your desired data set to a KML file as normal
  3. Make sure that the python script (Colorpy.py that you extracted in step 1) and the file you want to edit are located in the same folder on your computer.
  4. Open the Colorpy.py in any text editor
  5. Locate the line in the file that reads xmldoc = minidom.parse(“MoffettLaunch.kml”)and change the text inside the quotation marks to match the file you want to colorize: xmldoc = minidom.parse(“MyFileName.kml”) Save the file
  6. Execute the python script, and it will create a new file called “fileout.kml” that has the colorized data set.

Executing a python file requires you to have python installed. You should have no trouble finding a tutorial on running a python script on your particular operating system if you Google it, but if there is sufficient interest in this process, I will be happy to write a quick tutorial.

Leave a Reply