aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--alias3
-rwxr-xr-xscripts/csv.move_column (renamed from scripts/csv/csv.move_column)0
-rwxr-xr-xscripts/csv.reorder (renamed from scripts/csv/csv.reorder)0
-rwxr-xr-xscripts/csv2geojson (renamed from scripts/csv/csv2geojson)0
-rwxr-xr-xscripts/osm/osm.pbf.update56
5 files changed, 32 insertions, 27 deletions
diff --git a/alias b/alias
index 5e7dd66..704a49c 100644
--- a/alias
+++ b/alias
@@ -16,6 +16,9 @@ alias vv='vim ~/vimwiki/index.md'
16alias ve='vim ~/.vim_runtime/my_configs.vim' 16alias ve='vim ~/.vim_runtime/my_configs.vim'
17alias vr='vim -R' 17alias vr='vim -R'
18alias cdv='cd ~/.vim_runtime' # amix/vimrc repo 18alias cdv='cd ~/.vim_runtime' # amix/vimrc repo
19vs() {
20 vim $(which $1)
21}
19 22
20# shell 23# shell
21alias src="source $HOME/.$(basename $SHELL)rc" 24alias src="source $HOME/.$(basename $SHELL)rc"
diff --git a/scripts/csv/csv.move_column b/scripts/csv.move_column
index a62701f..a62701f 100755
--- a/scripts/csv/csv.move_column
+++ b/scripts/csv.move_column
diff --git a/scripts/csv/csv.reorder b/scripts/csv.reorder
index df928f1..df928f1 100755
--- a/scripts/csv/csv.reorder
+++ b/scripts/csv.reorder
diff --git a/scripts/csv/csv2geojson b/scripts/csv2geojson
index 085e12e..085e12e 100755
--- a/scripts/csv/csv2geojson
+++ b/scripts/csv2geojson
diff --git a/scripts/osm/osm.pbf.update b/scripts/osm/osm.pbf.update
index 694ae4d..599076f 100755
--- a/scripts/osm/osm.pbf.update
+++ b/scripts/osm/osm.pbf.update
@@ -1,30 +1,32 @@
1 PBF_FILE=$1 1#!/bin/sh
2 GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates
3 2
4 # get next sequence number and store it into NEW_SEQ 3PBF_FILE=$1
5 osmium fileinfo $PBF_FILE | \ 4GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates
6 grep osmosis_replication_sequence_number | \
7 cut -d'=' -f2 | \
8 sed 's/$/+1/' | bc | \
9 read NEW_SEQ
10 5
11 # while server has osc file with given sequence number, 6# get next sequence number and store it into NEW_SEQ
12 # get it and do file update 7osmium fileinfo $PBF_FILE | \
13 while 8grep osmosis_replication_sequence_number | \
14 SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') 9cut -d'=' -f2 | \
15 STATE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.state.txt 10sed 's/$/+1/' | bc | \
16 echo $STATE_URL 11read NEW_SEQ
17 [ $(curl.code $STATE_URL) != "404" ]
18 do
19 mkdir -p changes
20 CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz
21 echo $CHANGE_URL
22 curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \
23 osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \
24 --output-header=osmosis_replication_sequence_number=$NEW_SEQ \
25 --overwrite \
26 --output $NEW_SEQ.osm.pbf
27 12
28 PBF_FILE=$NEW_SEQ.osm.pbf 13# while server has osc file with given sequence number,
29 ((NEW_SEQ++)) 14# get it and do file update
30 done 15while
16 SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/')
17 STATE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.state.txt
18 echo $STATE_URL
19 [ $(curl.code $STATE_URL) != "404" ]
20do
21 mkdir -p changes
22 CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz
23 echo $CHANGE_URL
24 curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \
25 osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \
26 --output-header=osmosis_replication_sequence_number=$NEW_SEQ \
27 --overwrite \
28 --output $NEW_SEQ.osm.pbf
29
30 PBF_FILE=$NEW_SEQ.osm.pbf
31 ((NEW_SEQ++))
32done