* /trunk/src/gpstools/GPST.pm
[gpstools.git] / poisync
blob4ef303b2a15d18c72b2f40da5b4882f20691addf
1 #!/bin/bash
3 #=======================================================================
4 # $Id$
5 # File ID: a78bdf36-fafa-11dd-a4a9-000475e441b9
6 # For synkronisering av POI og waypoints fra uniten.
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
10 gpst -o pgwtab ~/gps/unit/wpdata.gpx ~/gps/poi/trans/*.gpx | \
11 psql gps -a -c "TRUNCATE tmpwayp; COPY tmpwayp (coor, name, ele, type, time, cmt, descr, src, sym) FROM STDIN;"
12 psql gps -a -c "UPDATE tmpwayp SET coor = point(round(coor[0]::numeric, 6), round(coor[1]::numeric, 6));"
13 psql gps -c "COPY (SELECT coor, name FROM tmpwayp WHERE type IS NULL ORDER BY coor[0] desc, coor[1]) TO STDOUT;" >/tmp/unit.tmp
14 psql gps -c "COPY (SELECT coor, name FROM tmpwayp WHERE type IS NOT NULL ORDER BY coor[0] desc, coor[1]) TO STDOUT;" >/tmp/poi.tmp
16 if [ "$1" = "-d" ]; then
17 diff -u /tmp/unit.tmp /tmp/poi.tmp
18 else
19 vimdiff /tmp/unit.tmp /tmp/poi.tmp