#!/usr/local/bin/perl # #なんでこうしないんだろう?、というようなところは、ただ単に #知らないからだけです。いい方法があれば教えてください。 # #pot2mp.pl require 'glc-sub.pl'; # #更新履歴 #2006/07/09 作成開始 #2006/11/03 ヘッダー情報などの修正 #2007/03/05 Type=0x05->0x1eに変更 #2007/09/30 ヘッダー情報などの修正 #2007/10/31 UUDの地図とヘッダー情報をあわせて同時表示可能に #2007/11/10 DrawPriority #2008/12/20 ヘッダーに日付情報を含めて出力 #todo #小縮尺用の地図を別にする #カシミール3Dのpotファイル専用 #書式は以下 #DAT=WGS84/WGS84/0.000/0.00000000/0/0/0 #ORD=POI/tex=/ido=034'41'24'5/kei=135'33'05'7/adr=1/alt=-5/col=12/pda=22-SEP-05/pti=21:44:54 #ORD=POI/tex=/ido=034'41'26'3/kei=135'33'05'4/adr=1/alt=+9/col=12/pda=22-SEP-05/pti=21:45:23 #ORD=POI/tex=/ido=034'41'25'8/kei=135'33'05'3/adr=2/alt=+9/col=12/pda=22-SEP-05/pti=21:47:20 #ORD=POI/tex=/ido=034'41'25'8/kei=135'33'05'3/adr=2/alt=+11/col=12/pda=22-SEP-05/pti=21:47:24 # 緯度 経度 軌跡番号 高度 表示色 日付 時刻 #日付・時刻はUTC #ORD=POI と tex= は固定にしておく #出力は.mpデータ $PI = 3.14159265358979; $time_min = 2147483647; #2^31-1 $time_max = 0; $body = ""; #$line_head = "[RGN40]\nType=0x1e\nLevel=5\nData0="; $line_head = "[RGN40]\nType=0x1e\nEndLevel=5\nData0="; $line_foot = "\n[END-RGN40]\n\n"; ################################################# #1行目(捨てる) $first = <>; ; #2行目 $second = <>; chop $second; ($ido1 ,$kei1 ,$address1 ,$altitude1 ,$col1 ,$pda1 ,$pti1) = &get_variables($second); $lat1 = &dmspot2deg($ido1); $long1 = &dmspot2deg($kei1); $time1 = &pdapti2time($pda1 ,$pti1); $time_max = $time1 > $time_max ? $time1 : $time_max; $time_min = $time1 < $time_min ? $time1 : $time_min; # print $line_head; # printf "(%.7f,%.7f)",$lat1,$long1; $body .= $line_head; $body .= sprintf "(%.7f,%.7f)",$lat1,$long1; #3行目以降 while (<>){ chop ; ($ido2 ,$kei2 ,$address2 ,$altitude2 ,$col2 ,$pda2 ,$pti2) = &get_variables($_); $lat2 = &dmspot2deg($ido2); $long2 = &dmspot2deg($kei2); if ($lat2 == 0 && $long2 == 0){next;} $time2 = &pdapti2time($pda2 ,$pti2); $time_max = $time2 > $time_max ? $time2 : $time_max; $time_min = $time2 < $time_min ? $time2 : $time_min; ### #スレッドを切る条件 #下のほうほど無条件 $adr_plus = 0; #もともとつながっていた(つなぐ) if ($address1 == $address2){ $adr_plus = 0; # print ","; $body .= ","; }else{ $adr_plus = 1; # print $line_foot; # print $line_head; $body .= $line_foot; $body .= $line_head; } #1行書き出し # printf "(%.7f,%.7f)",$lat2,$long2; $body .= sprintf "(%.7f,%.7f)",$lat2,$long2; $address1 = $address2; } #print $line_foot; $body .= $line_foot; ($max_day,$max_mon,$max_year) = (localtime($time_max))[3..5]; ($min_day,$min_mon,$min_year) = (localtime($time_min))[3..5]; $max_year +=1900; $min_year +=1900; $max_mon++; $min_mon++; $min = sprintf ("%4d%02d%02d",$min_year,$min_mon,$min_day); $max = sprintf ("%4d%02d%02d",$max_year,$max_mon,$max_day); #ヘッダー print "; Generated by pot2mp.pl 2008-12-20\n"; print "\n"; print "[IMG ID]\n"; print "ID=$min\n"; print "Name=GPS LOG $min-$max\n"; print <<"HEAD"; LblCoding=9 CodePage=1252 Datum=W84 Transparent=Y DrawPriority=31 Elevation=m POIOnly=N TreSize=1000 TreMargin=0.00000 RgnLimit=1024 Preprocess=G Levels=6 Level0=24 Level1=21 Level2=19 Level3=18 Level4=16 Level5=15 Zoom0=0 Zoom1=1 Zoom2=2 Zoom3=3 Zoom4=4 Zoom5=5 Copyright=TOKUNAGA, Takayuki pot2mp.pl [END-IMG ID] HEAD print $body; exit;