aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-11-09 23:47:55 +0800
committertypebrook <typebrook@gmail.com>2019-11-09 23:47:55 +0800
commit6e0c25edacd6ed2a9a5fc0136cb807f5e5c9ef36 (patch)
tree31ef5848ded7473245a7ce27ad4a5356aa11eec0
parent311141c2c369df20bad62f2edc33860edb092302 (diff)
update
-rw-r--r--utils/osm.utils.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/osm.utils.sh b/utils/osm.utils.sh
index 56f31d0..a89187f 100644
--- a/utils/osm.utils.sh
+++ b/utils/osm.utils.sh
@@ -33,17 +33,17 @@ OSM_API=$SERVER/api/0.6
33OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm) 33OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm)
34 34
35# get .osm format data 35# get .osm format data
36osm.get() { 36osm.fetch() {
37 curl -X GET $OSM_API/$1/$2 |\ 37 curl -X GET $OSM_API/$1/$2 |\
38 tee /tmp/osm &&\ 38 tee /tmp/osm &&\
39 echo content of $1 $2 is copied into /tmp/osm > /dev/tty 39 echo content of $1 $2 is copied into /tmp/osm > /dev/tty
40} 40}
41osm.get.full() { 41osm.fetch.full() {
42 curl -X GET $OSM_API/$1/$2/full |\ 42 curl -X GET $OSM_API/$1/$2/full |\
43 tee /tmp/osm &&\ 43 tee /tmp/osm &&\
44 echo content of $1 $2 and its members are copied into /tmp/osm > /dev/tty 44 echo content of $1 $2 and its members are copied into /tmp/osm > /dev/tty
45} 45}
46osm.get.history() { 46osm.fetch.history() {
47 curl -X GET $OSM_API/$1/$2/history |\ 47 curl -X GET $OSM_API/$1/$2/history |\
48 tee /tmp/osm &&\ 48 tee /tmp/osm &&\
49 echo history of $1 $2 are copied into /tmp/osm > /dev/tty 49 echo history of $1 $2 are copied into /tmp/osm > /dev/tty
@@ -73,13 +73,13 @@ osm.extract.ids() {
73osm.upload.to() { 73osm.upload.to() {
74 cat - > /tmp/osm 74 cat - > /tmp/osm
75 75
76 osm.get.ids < /tmp/osm |\ 76 osm.extract.ids < /tmp/osm |\
77 sed 's#.*#osm.extract \0 < /tmp/osm#g' |\ 77 sed 's#.*#osm.extract \0 < /tmp/osm#g' |\
78 sed "s/.*/\0 \| osm.changeset.add $1/g" |\ 78 sed "s/.*/\0 \| osm.changeset.add $1/g" |\
79 while read -r command 79 while read -r command
80 do 80 do
81 cat <(echo $command) 81 echo $command
82 source <(echo "("$command " &)") 82 source<(echo "($command &)")
83 done 83 done
84} 84}
85# query .osm format STDIN 85# query .osm format STDIN
@@ -129,7 +129,7 @@ osm.changeset.create() {
129} 129}
130# add a new element into changeset 130# add a new element into changeset
131osm.changeset.add() { 131osm.changeset.add() {
132 element=$(cat -) 132 element=$(cat)
133 header=$(echo $element | grep -E "<(node|way|relation)\s") 133 header=$(echo $element | grep -E "<(node|way|relation)\s")
134 ele_type=$(echo $header | sed -r 's/.*<(node|way|relation).*$/\1/') 134 ele_type=$(echo $header | sed -r 's/.*<(node|way|relation).*$/\1/')
135 id=$(echo $header | sed -r 's/.* id=\"([^"]+)\".*$/\1/') 135 id=$(echo $header | sed -r 's/.* id=\"([^"]+)\".*$/\1/')