aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-11-08 08:30:08 +0800
committertypebrook <typebrook@gmail.com>2019-11-08 09:11:12 +0800
commit7cc033706a139c0e28c60247994dce2359b23994 (patch)
tree7529263fa51d316e61e302931d1a3646c7ded34c
parent2680d8a7fbf91110ab2913b90981c3c6b107d113 (diff)
update
-rwxr-xr-xscripts/changeset34
-rw-r--r--utils/osm.utils.sh25
2 files changed, 16 insertions, 43 deletions
diff --git a/scripts/changeset b/scripts/changeset
deleted file mode 100755
index 6138d7e..0000000
--- a/scripts/changeset
+++ /dev/null
@@ -1,34 +0,0 @@
1#! /bin/bash
2
3OSM_USER_PASSWD=$(cat ~/git/settings/tokens/osm)
4
5#server=https://master.apis.dev.openstreetmap.org
6server=https://api.openstreetmap.org
7comment="change is_in format"
8
9for i in "$@"
10do
11case $i in
12 -s)
13 lon_col=0; lat_col=1
14 shift;;
15
16 *)
17 csv=$i
18 shift;;
19esac
20done
21
22info="<osm>
23 <changeset>
24 <tag k='comment' v='$comment'/>
25 </changeset>
26 </osm>
27 "
28
29echo $info |\
30curl -u $OSM_USER_PASSWD -i --upload-file - $server/api/0.6/changeset/create |\
31tee /dev/tty |\
32tail -1 |\
33xsel -ib
34
diff --git a/utils/osm.utils.sh b/utils/osm.utils.sh
index 7716e41..a742fe9 100644
--- a/utils/osm.utils.sh
+++ b/utils/osm.utils.sh
@@ -4,8 +4,8 @@ osm.utils.edit() {
4 vim $FILENAME && source $FILENAME 4 vim $FILENAME && source $FILENAME
5} 5}
6 6
7#SERVER=https://master.apis.dev.openstreetmap.org 7SERVER=https://master.apis.dev.openstreetmap.org
8SERVER=https://api.openstreetmap.org 8#SERVER=https://api.openstreetmap.org
9OSM_API=$SERVER/api/0.6 9OSM_API=$SERVER/api/0.6
10OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm) 10OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm)
11 11
@@ -25,12 +25,18 @@ osm.get.ids() {
25 sed -nr 's/.*<(node|way|relation) id=\"([^"]+)\".*/\1 \2/p' 25 sed -nr 's/.*<(node|way|relation) id=\"([^"]+)\".*/\1 \2/p'
26} 26}
27osm.upload() { 27osm.upload() {
28 CHANGESET_ID=$(osm.changeset.create)
29
30 cat - > /tmp/osm 28 cat - > /tmp/osm
31 source <(osm.get.ids < /tmp/osm |\ 29 echo still
32 sed 's#.*#osm.extract \0 < /tmp/osm#g' |\ 30 osm.changeset.create
33 sed "s/.*/\0 \| osm.changeset.add $CHANGESET_ID/g") 31 #CHANGESET_ID=$(osm.changeset.create)
32
33 #osm.get.ids < /tmp/osm |\
34 #sed 's#.*#osm.extract \0 < /tmp/osm#g' |\
35 #sed "s/.*/\0 \| osm.changeset.add $CHANGESET_ID/g" |\
36 #while read
37 #do
38 # echo $CHANGESET
39 #done
34} 40}
35# query osm-related file with .osm format output 41# query osm-related file with .osm format output
36osm.file.query() { 42osm.file.query() {
@@ -61,9 +67,10 @@ osm.changeset.create() {
61 " 67 "
62 68
63 echo $info |\ 69 echo $info |\
64 curl -u $OSM_USER_PASSWD -i --upload-file - $SERVER/api/0.6/changeset/create |\ 70 curl -u $OSM_USER_PASSWD -i --upload-file - $OSM_API/changeset/create |\
65 tee /dev/tty |\ 71 tee /dev/tty |\
66 tail -1 72 tail -1 |\
73 xsel -ib
67} 74}
68# add a new element into changeset 75# add a new element into changeset
69osm.changeset.add() { 76osm.changeset.add() {