I have a list of several hundred lat/lon coordinates in a Microsoft Access file. They are in a single column, decimal format, comma separated. Ex: 12.34, 67.89
What is the easiest way to convert this to a Google Earth kml or kmz file, in which each coord is a placemark? I’ve been searching for about an hour, trying various little command line tools with no success, and my brain is tired. Help, please.
Just write a simple Perl script. Here’s the KML reference and tutorial. Here’s a very simple example, which assumes a CSV file full of <lat>,<lon> pairs as the first two fields on the line; the names assigned are just the line numbers.
#!/usr/bin/perl
print <<"HDR";
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Folder>
HDR
while ( <STDIN> ) {
chomp;
my @ll = split /,/, $_;
print <<"REC";
<Placemark>
<name>$.</name>
<Point><coordinates>$ll[1],$ll[0],0</coordinates></Point>
</Placemark>
REC
}
print <<"FTR";
</Folder>
</kml>
FTR
RTM to customize as you like.
Thanks! That worked great!