diff options
author | typebrook <typebrook@gmail.com> | 2019-11-09 23:47:55 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-11-09 23:47:55 +0800 |
commit | 6e0c25edacd6ed2a9a5fc0136cb807f5e5c9ef36 (patch) | |
tree | 31ef5848ded7473245a7ce27ad4a5356aa11eec0 | |
parent | 311141c2c369df20bad62f2edc33860edb092302 (diff) |
update
-rw-r--r-- | utils/osm.utils.sh | 14 |
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 | |||
33 | OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm) | 33 | OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm) |
34 | 34 | ||
35 | # get .osm format data | 35 | # get .osm format data |
36 | osm.get() { | 36 | osm.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 | } |
41 | osm.get.full() { | 41 | osm.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 | } |
46 | osm.get.history() { | 46 | osm.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() { | |||
73 | osm.upload.to() { | 73 | osm.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 |
131 | osm.changeset.add() { | 131 | osm.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/') |