aboutsummaryrefslogtreecommitdiffhomepage
path: root/utils/osm
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-11-13 20:59:33 +0800
committertypebrook <typebrook@gmail.com>2019-11-13 20:59:33 +0800
commit0d6adfe752875aa1e4a985dbd92509af7f1fbdf8 (patch)
treefc9ea40b77a20be7ca075ec4ab94bd87d75be65e /utils/osm
parentc8ade8628c52d60b8b091a463c3b3df907203a40 (diff)
update
Diffstat (limited to 'utils/osm')
-rw-r--r--utils/osm15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/osm b/utils/osm
index 9dcd7c1..532d133 100644
--- a/utils/osm
+++ b/utils/osm
@@ -43,8 +43,8 @@ osm.goto() {
43 xdg-open https://www.openstreetmap.org/$1/$2 43 xdg-open https://www.openstreetmap.org/$1/$2
44} 44}
45 45
46SERVER=https://master.apis.dev.openstreetmap.org 46#SERVER=https://master.apis.dev.openstreetmap.org
47#SERVER=https://api.openstreetmap.org 47SERVER=https://api.openstreetmap.org
48OSM_API=$SERVER/api/0.6 48OSM_API=$SERVER/api/0.6
49OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm) 49OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm)
50 50
@@ -57,17 +57,19 @@ osm.api.fetch() {
57osm.api.fetch.full() { 57osm.api.fetch.full() {
58 curl -X GET $OSM_API/$1/$2/full |\ 58 curl -X GET $OSM_API/$1/$2/full |\
59 tee /tmp/osm &&\ 59 tee /tmp/osm &&\
60 echo content of $1 $2 and its members are copied into /tmp/osm > /dev/tty 60 echo "\n" content of $1 $2 and its members are copied into /tmp/osm > /dev/tty
61} 61}
62osm.api.fetch.history() { 62osm.api.fetch.history() {
63 curl -X GET $OSM_API/$1/$2/history |\ 63 curl -X GET $OSM_API/$1/$2/history |\
64 tee /tmp/osm &&\ 64 tee /tmp/osm &&\
65 echo history of $1 $2 are copied into /tmp/osm > /dev/tty 65 echo &&\
66 echo "\n" history of $1 $2 are copied into /tmp/osm > /dev/tty
66} 67}
67osm.api.referenced.relation() { 68osm.api.referenced.relation() {
68 curl -X GET $OSM_API/$1/$2/relations |\ 69 curl -X GET $OSM_API/$1/$2/relations |\
69 tee /tmp/osm &&\ 70 tee /tmp/osm &&\
70 echo relations contain $1 $2 are copied into /tmp/osm > /dev/tty 71 echo &&\
72 echo "\n" relations contain $1 $2 are copied into /tmp/osm > /dev/tty
71} 73}
72osm.member.relation() { 74osm.member.relation() {
73 sed -nr "/<relation/,/<\/relation/ { 75 sed -nr "/<relation/,/<\/relation/ {
@@ -112,7 +114,7 @@ osm.list.tags() {
112 done 114 done
113 115
114 cat /tmp/osm 116 cat /tmp/osm
115 echo tag list is also copied into /tmp/osm > /dev/tty 117 echo "\ntag list is also copied into /tmp/osm" > /dev/tty
116} 118}
117# extract an element from .osm format STDIN 119# extract an element from .osm format STDIN
118# $1 as [node|way|relation], $2 as id 120# $1 as [node|way|relation], $2 as id
@@ -197,6 +199,7 @@ osm.api.changeset.create() {
197 199
198 echo " copied into clipboard" 200 echo " copied into clipboard"
199 echo "changeset created, check $SERVER/changeset/$changeset_id" 201 echo "changeset created, check $SERVER/changeset/$changeset_id"
202 echo $changeset_id | xsel -ib
200} 203}
201# add a new element into changeset 204# add a new element into changeset
202osm.api.changeset.add() { 205osm.api.changeset.add() {