#!/bin/bash
# usage:
#   poi2kmz poi.asc poi.kmz
#
# convert ASCII POI File to Google Placemarks

if [ $# -ne 2 ]; then
  echo "usage: poi2kmz poi.asc poi.kmz"
  exit
fi

tempdir=`mktemp -d`

gpsbabel -w -i xcsv,style=/etc/gpsbabel/style/csv_poi.style  -c latin1 -f "$1" -o kml -F $tempdir/doc.kml
zip -q -9 -j $tempdir/doc.kmz $tempdir/doc.kml
cp $tempdir/doc.kmz "$2"
rm -r $tempdir

