gpst: Don’t use bareword file handle OutFP
[gpstools.git] / poisync
blob3076f13655a7706dce6ae007478de5e4a6dedd35
1 #!/bin/bash
3 #=======================================================================
4 # poisync
5 # File ID: a78bdf36-fafa-11dd-a4a9-000475e441b9
6 # For synkronisering av POI og waypoints fra uniten.
7 # License: GNU General Public License version 3 or later.
8 #=======================================================================
10 gpst -o pgwtab ~/gps/unit/waypoints.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