From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create a kml file?

Solved!
Go to solution

Greetings,

 

In many of my applications I record GPS tracks. At present I log the lat/longs every second to a csv file in degrees, decimal minutes (D M.MM) format as we move. I would like to simultaneously save this data as a kml file that can be immediately opened in Google Earth at the end of our transect. Is there a way to do this in LabVIEW? ( I am using 2013).

 

I know that kml files want the coordinates in the format of  long, lat, in decimal degrees (D.DDD) and I have already written subVI's to do this.

 

Thanks,

 

Karl

0 Kudos
Message 1 of 6
(4,198 Views)

Hi ,

     See to the below attachment , It solves your question.

 

kudos welcome 😄

 

Certified LabVIEW Developer
Best LabVIEW Programmer @NIDAYS 2015
0 Kudos
Message 2 of 6
(4,189 Views)

@smsanthosh wrote:

Hi ,

     See to the below attachment , It solves your question.

 

kudos welcome 😄

 


The red statement is a little overenthusiastic. You don't show in that example how to add the actual coordinates into the file.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(4,183 Views)

Thanks for the quick reply,

 

So I am essentially creating an xml file...kml is basically the same I take it.

 

Google Developers show a file as shown below to create a GPS path in kml form:

 

If I used the constants as shown by smsanthosh in his example to write all the headers and jibber jabber, then add my coordinates as I receive them to the file, then close file when the transect ends, this should work I think.

 

Two questions; what is the open file icon with the O N in it in this example? I am not familiar with that one and can't find it.

 

Just by giving the text file the extension kml, does this make it a kml file?

 

Thanks

 

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"> <Document>
<name>Paths</name>
<description>Examples of paths. Note that the tessellate tag is by default
set to 0. If you want to create tessellated lines, they must be authored
(or edited) directly in KML.</description> <Style id="yellowLineGreenPoly">
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style> <Placemark>
<name>Absolute Extruded</name>
<description>Transparent green wall with yellow outlines</description>
<styleUrl>#yellowLineGreenPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>

<altitudeMode>absolute</altitudeMode>
<coordinates> -112.2550785337791,36.07954952145647,2357
-112.2549277039738,36.08117083492122,2357
-112.2552505069063,36.08260761307279,2357
-112.2564540158376,36.08395660588506,2357
-112.2580238976449,36.08511401044813,2357
-112.2595218489022,36.08584355239394,2357
-112.2608216347552,36.08612634548589,2357
-112.262073428656,36.08626019085147,2357
-112.2633204928495,36.08621519860091,2357
-112.2644963846444,36.08627897945274,2357
-112.2656969554589,36.08649599090644,2357 </coordinates>
</LineString> </Placemark>
</Document> </kml>

 

0 Kudos
Message 4 of 6
(4,165 Views)

Hi,

    Ya saving the text file to *.kml is enough. Once this menthod works for you post a reply to the comment....:)

Certified LabVIEW Developer
Best LabVIEW Programmer @NIDAYS 2015
Message 5 of 6
(4,137 Views)
Solution
Accepted by topic author KarlosAmigos

Well, that was a lot easier than I thought it would be!

 

I will have to do more coding to append my streaming GPS data to the file, but the basics are all there. In my attached VI, I have just used a constant with some coordinates from the Grand Canyon and it worked perfectly.

 

Many Thanks

 

Karl

Message 6 of 6
(4,125 Views)