head 1.1; access; symbols; locks; strict; comment @# @; expand @o@; 1.1 date 2007.03.27.15.42.01; author BartMeganck; state Exp; branches; next ; desc @none @ 1.1 log @Perl script : takes in a csv, writes out kml for Google Earth @ text @#!/usr/local/bin/perl $infile="/home/bmeganck/Desktop/input.txt"; #$outfile="/Users/bmeganck/Desktop/outfile.txt"; open inputfile, $infile; $part1 = ""; $part2 = ""; $part3 = ""; # default values $name = "0°N 0°E"; $description = "Zero - zero"; $longitude = "0" ; $latitude = "0"; $part4 = ""; $part5 = "305.888079229456846.7242569966264549.0613343917123301relativeToGround"; $part6=",50"; while () { # $_=; @@details=split /,/ ; $name = @@details[0]; $description = @@details[1]; $longitude = @@details[2] ; $latitude = @@details[3]; print "$name"; $outfile = "/home/bmeganck/Desktop/$name.kml"; open outputfile, ">>$outfile"; print outputfile ($part1,$description,$part2,$name,$part3,$longitude,$part4,$latitude,$part5,$longitude,",",$latitude,$part6) or die "cannot"; close outputfile; } close inputfile; @