|
-
Sep 6th, 2008, 03:55 PM
#1
Thread Starter
Junior Member
Create a KML (XML) File from a text file with HTML TAGS
Hi Guys,
I need a little help - i will try and explain this as best i can!!
I need to create a xml file the as the same template below
Code:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<description>
<![CDATA[
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0000FF" width="100%" id="AutoNumber1" height="86">
<tr>
<td width="100%" colspan="2" height="18"><b><font face="Tahoma" size="2">
Metar Report for statloc</font></b></td>
</tr>
<tr>
<td width="50%" height="16"><font face="Tahoma" size="2">Temp</font></td>
<td width="50%" height="16"><font face="Tahoma" size="2">TMP c</font></td>
</tr>
<tr>
<td width="50%" height="16"><font face="Tahoma" size="2">RH</font></td>
<td width="50%" height="16"><font face="Tahoma" size="2">RH %</font></td>
</tr>
<tr>
<td width="50%" height="16"><font face="Tahoma" size="2">Dew Point</font></td>
<td width="50%" height="16"><font face="Tahoma" size="2">DP c</font></td>
</tr>
<tr>
<td width="50%" height="16"><font face="Tahoma" size="2">Sea Level Pressure</font></td>
<td width="50%" height="16"><font face="Tahoma" size="2">SLP c</font></td>
</tr>
<tr>
<td width="50%" height="16"><font face="Tahoma" size="2">Wind Speed</font></td>
<td width="50%" height="16"><font face="Tahoma" size="2">WSPD mph</font></td>
</tr>
<tr>
<td width="50%" height="4"><font face="Tahoma" size="2">Wind Gust</font></td>
<td width="50%" height="4"><font face="Tahoma" size="2">WGUST mph</font></td>
</tr>
<tr>
<td width="50%" height="4"><font face="Tahoma" size="2">Wind Direction</font></td>
<td width="50%" height="4"><font face="Tahoma" size="2">WDIR</font></td>
</tr>
<tr>
<td width="50%" height="4"><font face="Tahoma" size="2">Last Updated @</font></td>
<td width="50%" height="4"><font face="Tahoma" size="2">DATE_TIME GMT</font></td>
</tr>
</table>
]]>
</description>
<Point>
<coordinates>-1,52</coordinates>
</Point>
</Placemark>
</Document>
</kml>
The code which is coloured in as RED above, is the data i need from my text file. AS Below:
Code:
EIDW,53.4,-6.25,68.0,20080906,1930,13.1,9.1,76.6,7.2,,320.0,1004,,
It is a csv.
The data follows this order, as the data i need to fill in the red parts of the KML(xml) file.
1. statloc
2. LAT
3. LON
Note that the lat and lon needs to go into the coordinates tags lon,lat and maintaining the comma
4. ELE
5. DATE
6. TIME
Note the date and time needs to go into the Date_Time Tag
7. TMP
8. DP
9. RH
10. WSPD
11. WGUST
12 WDIR
13 SLP
----------------------------------------------
Background.
I am planning to use this to create live weather details across the globe using Google Maps.
Any Questions
Much Help is needed please.
Thanks
Ian
P.S
The infile is called TO_FTP.txt
the outfile called google_metar.kml
Last edited by gucci; Sep 6th, 2008 at 04:19 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|