/ Published in: Perl
OZIexplorer is hard to calibrate maps. And I need a tool to calibrate the .map files generated from TrekBuddy_Atlas_Creator_v1.1. So I wrote it.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/path/to/perl # 2009/7/15 # tool for calibrate latitude & longitude in *.map files generated # by TrekBuddy_Atlas_Creator_v1.1 my $line; my $argc = @ARGV; # Actual: N39°4'21.9" E117°15'49.6" # Google Map: N39°4'26.3" E117°16'13.6" my $version = "090715"; my $bar = "VERSION: $version, vinocui\@gmail.com, twitter.com/vinocui\n"; if ($argc != 5){ print "\nDescriptions: ActualN: Actual North latitude ActualE: East longitude MapN: the North latitude of the right point in your Trekbuddy MapE: the East latitude of the right point in your Trekbbuddy.\n"; } $mapfile = $ARGV[4]; # A: Actual, M: Map. n:North, e: East # 0,1,2,3 --> AN, AE, MN, ME. my @D = (); my @M = (); my @S = (); for($i = 0; $i < 4; $i++){ $D[$i] = $d; $M[$i] = $m; $S[$i] = $s; } # A: Actual, M: Map. n:North, e: East # 0,1,2,3 --> AN, AE, MN, ME. my $nMcb = ($S[0]/60.0 + $M[0]) - ($S[2]/60.0 + $M[2]); my $eMcb = ($S[1]/60.0 + $M[1]) - ($S[3]/60.0 + $M[3]); my $nDcb = ($S[0]/60.0 + $M[0])/60.0 - ($S[2]/60.0 + $M[2])/60.0; my $eDcb = ($S[1]/60.0 + $M[1])/60.0 - ($S[3]/60.0 + $M[3])/60.0; while (my $line = <INFILE>){ } while (my $line = <INFILE>) { if($line =~ /Point01|Point02|Point03|Point04/g){ for(my $i; $i<@segs; $i++){ my $v = 0.0; if($i == 7){ }elsif($i == 10 ){ } if($i != (@segs - 1)) { } } next; } if($line =~ /MMPLL/g){ for(my $i = 0; $i < @segs; $i++){ if ($i == 2){ }elsif($i == 3){ } if($i != (@segs - 1)) { }else{ } } next; } }