Google Mapsのマイマップで作成したマーカーとラインを、Waypoint、Route or
Trackデータとしてカシミール3Dに読み込む試み。
最初にGPS Babel 1.3.3という変換ツールを試みたが、
期待したようにはうごかなかったので、簡易な変換ツールを自作した。
マイマップから出力したラインとマーカーだけ変換するつもりで書いたので、
KMLを完全に読み込むことができるわけではありません。このスクリプトは
カシミール3DのCSV読み込みプラグイン
で読むことができるCSV形式でstdoutにデータを変換して出力する。
なので、事前にこのカシミール3Dのプラグインをインストールしておく必要がある。
スクリプトはこれ。
http://reddog.s35.xrea.com/software/kml2csv.tcl
tclの実行環境と、tclのxml拡張のtDOMが必用です。またインターネットに接続している必要があります。
tclsh kml2csv.tcl data.kml > data.csv
みたいにして使う。マーカーはwaypointに、ラインは-tオプションでrouteかtrackのどちらかに変換する。デフォルトではtrackに変換する。routeに変換するときは
tclsh kml2csv.tcl -t route output.kml > data.csv
みたいに-tでrouteを指定する。-tでの指定を省略したときはtrackに変換する。routeは各点ごとに名前を付けないといけないが、KMLのラインから変換する場合は意味のある名前をつけることができないので、ただの連番の名前になる。
使ってみる。
まずはマイマップで適当にライン一つとマーカー二つを作ってみる。
KMLを押してKMLファイルをダウンロードする。で、これをkml2csv.tclで
tclsh kml2csv.tcl 京都御所.kml > 京都御所.csv
と変換する。ファイルの中身は、
H1,御所散歩,0,0,255,5,1 T1,T1-001,35.01030,135.45471,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-002,35.01057,135.45472,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-003,35.01070,135.45436,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-004,35.01155,135.45435,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-005,35.01156,135.45388,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-006,35.01206,135.45387,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-007,35.01234,135.45388,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-008,35.01233,135.45434,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-009,35.01206,135.45435,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-010,35.01208,135.45502,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-011,35.01243,135.45502,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-012,35.01323,135.45497,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-013,35.01392,135.45491,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-014,35.01390,135.45389,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-015,35.01393,135.45388,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-016,35.01401,135.45388,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-017,35.01404,135.45376,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-018,35.01409,135.45367,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-019,35.01400,135.45357,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-020,35.01393,135.45352,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-021,35.01389,135.45352,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-022,35.01389,135.45385,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-023,35.01333,135.45387,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-024,35.01333,135.45380,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-025,35.01337,135.45363,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-026,35.01339,135.45358,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-027,35.01325,135.45357,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-028,35.01301,135.45358,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 T1,T1-029,35.01300,135.45330,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0 W2,目印 1,35.01118,135.45505,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0,0,1,, W3,目印 2,35.01300,135.45386,0.000000,2007-07-06,03:16:32,WGS84,0.0,0.0,0,1,,
こんな感じにtrack一つ、waypoint二つが出力されている。 これをカシミール3Dへ「ツール->GPSファイルツール->CSV形式から読み込み」で読み込む。
終り。このカシミール3Dの地図はプロアトラスから切り出したビットマップ地図です。