2 #=======================================================================
4 # File ID: a78bdf36-fafa-11dd-a4a9-000475e441b9
5 # For synkronisering av POI og waypoints fra uniten.
6 #=======================================================================
8 gpst
-o pgwtab ~
/gps
/unit
/wpdata.gpx ~
/gps
/poi
/trans
/*.gpx | psql gps
-a -c "TRUNCATE tmpwayp; COPY tmpwayp FROM STDIN;"
9 psql gps
-a -c "UPDATE tmpwayp SET coor = point(round(coor[0]::numeric, 6), round(coor[1]::numeric, 6));"
10 psql gps
-a -c "COPY (SELECT coor, name FROM tmpwayp WHERE type IS NULL ORDER BY coor[0] desc, coor[1]) TO '/tmp/un';"
11 psql gps
-a -c "COPY (SELECT coor, name FROM tmpwayp WHERE type IS NOT NULL ORDER BY coor[0] desc, coor[1]) TO '/tmp/p';"
13 if [ "$1" = "-d" ]; then
14 diff -u /tmp
/un
/tmp
/p
16 vimdiff
/tmp
/un
/tmp
/p