Writing KML for large time series data set

463 views
Skip to first unread message

ghagler

unread,
Jan 24, 2008, 11:07:57 AM1/24/08
to KML Developer Support - Getting Started with KML
Hi there,

I am hoping to write KML code to take data in a txt/csv format and
project it onto GE, displayed as a time series (with the time slide
feature) and markers colored by the data value. I am using GE Pro.

My data output would have the following columns and is expected to
have >1000 data points:
timestamp
lat
long
data value

A couple of questions:
(1) Is there a way to write KML code that would step through such a
data set and display on GE? It appears GE will accept csv/txt data
files, but does not have a time feature as an option.
(2) Is there a way to have data points fade out after displaying for a
certain time increment? (say, have data point #1 fade out while data
point #101 is showing up)

Thanks!





Jonathan van Tuijl

unread,
Jan 24, 2008, 9:41:31 PM1/24/08
to KML Developer Support - Getting Started with KML
ghagler wrote:
> I am hoping to write KML code to take data in a txt/csv format and
> project it onto GE, displayed as a time series (with the time slide
> feature) and markers colored by the data value.  I am using GE Pro.
>
> My data output would have the following columns and is expected to
> have >1000 data points:
> timestamp
> lat
> long
> data value
>
> A couple of questions:
> (1) Is there a way to write KML code that would step through such a
> data set and display on GE? It appears GE will accept csv/txt data
> files, but does not have a time feature as an option.

You'll have to write your own script/program that reads the CSV file
and generates appropriate KML. The output might look like:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>Data</name>
<Style id="red">
<IconStyle>
<color>ff0000ff</color>
</IconStyle>
</Style>
<Style id="green">
<IconStyle>
<color>ff00ff00</color>
</IconStyle>
</Style>
...
<Placemark>
<name>1</name>
<TimeStamp>
<when>2008-01-01</when>
</TimeStamp>
<styleUrl>#red</styleUrl>
<Point>
<coordinates>0,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>2</name>
<TimeStamp>
<when>2008-01-02</when>
</TimeStamp>
<styleUrl>#green</styleUrl>
<Point>
<coordinates>1,0</coordinates>
</Point>
</Placemark>
...
</Document>
</kml>

You might want to use a TimeSpan instead, to get rid of the time of
nothingness between points.

> (2) Is there a way to have data points fade out after displaying for a
> certain time increment?  (say, have data point #1 fade out while data
> point #101 is showing up)

I don't think you can really "fade" them, but by setting the time
slider to a certain range any points not in that range disappear.

Jonathan

ghagler

unread,
Jan 29, 2008, 9:50:15 AM1/29/08
to KML Developer Support - Getting Started with KML
Thanks for the response!

Any suggestion on a simple method to generate KML? I have written
scripts in the past for data analysis in programs like MATLAB (if-
then, loops, calculations, etc) but do not have experience yet with
writing a script that generates another type of script! Any advice on
this would be a big help!

- Gayle


ManoM

unread,
Jan 29, 2008, 1:15:10 PM1/29/08
to KML Developer Support - Getting Started with KML
Hi ghagler,

If you're interested in MATLAB, there's this resource. I can't vouch
for it, knowing nothing about MATLAB, but others have found it useful:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=12225

Also, this page here has some articles about creating KML using PHP
and Python, that may be helpful:
http://code.google.com/support/bin/topic.py?topic=11367

This is a technical distinction, perhaps, but KML is not a scripting
language, it's a data format expressed in XML markup. It may be
helpful to think of it that way.

ManoM

ghagler

unread,
Jan 29, 2008, 2:09:09 PM1/29/08
to KML Developer Support - Getting Started with KML
Thanks - that should be a big help getting started.
- Gayle

On Jan 29, 1:15 pm, ManoM wrote:
> Hi ghagler,
>
> If you're interested in MATLAB, there's this resource. I can't vouch
> for it, knowing nothing about MATLAB, but others have found it useful:http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objec...
>
> Also, this page here has some articles about creating KML using PHP
> and Python, that may be helpful:http://code.google.com/support/bin/topic.py?topic=11367
>
> This is a technical distinction, perhaps, but KML is not a scripting
> language, it's a data format expressed in XML markup. It may be
> helpful to think of it that way.
>
> ManoM
>
> On Jan 29, 6:50 am, ghagler wrote:
>
>
>
> > Thanks for the response!
>
> > Any suggestion on a simple method to generate KML?  I have written
> > scripts in the past for data analysis in programs like MATLAB (if-
> > then, loops, calculations, etc) but do not have experience yet with
> > writing a script that generates another type of script!  Any advice on
> > this would be a big help!
>
> > - Gayle- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages