iphoto2kml.pl

Read GPS data form EXIF of image file that placed in iPhoto album, and generate KML file.

You have to install the following CPAN Modules:

Mac::Tie::PList - Parse Apple NSDictionary objects (e.g. Preference Lists)
http://search.cpan.org/~gbrock/Mac-Tie-PList-0.01/lib/Mac/Tie/PList.pm
Image::ExifTool - Read and write meta information
http://search.cpan.org/~exiftool/Image-ExifTool-6.17/lib/Image/ExifTool.pod
example:
./iphoto2kml.pl --list

You can get the list of iPhoto album.

example:
   AlbumId PhotoCount AlbumName 
      8861     1340   2006-09 CycleOregon
      8862       21   2006-09-08 Portland, OR

The AlbumId of the album '2006-09-08 Portland, OR' is 8862.

usage:
iphoto2kml.pl 'AlbumId'
example:
./iphoto2kml.pl 8862 > portland.kml

You can get a KML file of AlbumId 8862. You can open the KML file with Google Earth.

usage:
iphoto2kml.pl 'AlbumId' 'path for link'
iphoto2kml.pl 'AlbumId' 'path for link' 'path of thumbnail image'
example:
./iphoto2kml.pl 8862 'http://onohiroki.cycling.jp/image/' 'http://onohiroki.cycling.jp/image/thumbnail/' > portland.kml

Generate a link to 'http://onohiroki.cycling.jp/image/DSCN3513.JPG' and use thumbnail image 'http://onohiroki.cycling.jp/image/thumbnail/DSCN3513.JPG'

If you want to upload KML file to Internet, you have to define 'path for link'.

iPhoto のアルバムを指定して,画像ファイルの EXIF から位置情報である GPS データを読み込んで KML ファイルを生成する事ができます. Terminal.app などでコマンドとして利用します. 以下の二つの CPAN モジュールをあらかじめインストールしておく必要があります.
Mac::Tie::PList - Parse Apple NSDictionary objects (e.g. Preference Lists)
http://search.cpan.org/~gbrock/Mac-Tie-PList-0.01/lib/Mac/Tie/PList.pm
Image::ExifTool - Read and write meta information
http://search.cpan.org/~exiftool/Image-ExifTool-6.17/lib/Image/ExifTool.pod
iphoto2kml.pl が保存されているディレクトリに移動してから以下のようにコマンドを打ち込みます. ./iphoto2kml.pl --list すると iPhoto に登録されているアルバムの一覧が表示されます. 例: AlbumId PhotoCount AlbumName 8861 1340 2006-09 CycleOregon 8862 21 2006-09-08 Portland, OR   AlbumId がアルバムの ID 番号です.例えば「2006-09-08 Portland, OR」というアルバムは AlbumId が 8862 です. 例: ./iphoto2kml.pl 8862 > portland.kml AlbumId が 8862 のアルバムの KML ファイルが得られます.これを Google Earth で開く事ができます. iphoto2kml.pl 'AlbumId' 'path for link' iphoto2kml.pl 'AlbumId' 'path for link' 'path of thumbnail image' このようにすれば,画像のリンク先のパスと,サムネイル画像のパスを指定できます. 例: ./iphoto2kml.pl 8862 'http://onohiroki.cycling.jp/image/' 'http://onohiroki.cycling.jp/image/thumbnail/' > portland.kml こうすれば,例えば http://onohiroki.cycling.jp/image/DSCN3513.JPG という画像にリンクし,サムネイル画像を http://onohiroki.cycling.jp/image/thumbnail/DSCN3513.JPG とすることができます. もし,KML ファイルを Internet で公開するのであれば,'path for link' を適切に定義しなければなりません. おのひろき onohiroki@cup.com http://onohiroki.cycling.jp/