diff options
-rw-r--r-- | utils/osm | 31 |
1 files changed, 17 insertions, 14 deletions
@@ -3,19 +3,19 @@ | |||
3 | FILENAME=$0 | 3 | FILENAME=$0 |
4 | 4 | ||
5 | osm.help() { | 5 | osm.help() { |
6 | echo " | 6 | echo ' |
7 | COMMANDS: | 7 | COMMANDS: |
8 | osm.help | 8 | osm.help |
9 | util.osm.edit | 9 | util.osm.edit |
10 | 10 | ||
11 | osm.api.changeset.create | 11 | osm.api.changeset.create create a new changeset and return its ID |
12 | osm.api.changeset.update | 12 | osm.api.changeset.update [changeset ID], update changeset with new comment |
13 | osm.api.changeset.add | 13 | osm.api.changeset.add [changeset ID], STDIN=osm element, add it into changeset |
14 | osm.api.changeset.close | 14 | osm.api.changeset.close [changeset ID], close the given changeset |
15 | osm.api.fetch | 15 | osm.api.fetch [element type] [element ID] |
16 | osm.api.fetch.full | 16 | osm.api.fetch.full like .fetch, but return with all referenced elements |
17 | osm.api.fetch.history | 17 | osm.api.fetch.history [element type] [element ID] |
18 | osm.api.member.relation | 18 | osm.api.member.relation [element type] [element ID] [member type] get first relations reference it as member type |
19 | osm.api.referenced.relation | 19 | osm.api.referenced.relation |
20 | osm.api.referenced.way | 20 | osm.api.referenced.way |
21 | osm.api.upload.to | 21 | osm.api.upload.to |
@@ -33,7 +33,7 @@ COMMANDS: | |||
33 | osm.pbf.update | 33 | osm.pbf.update |
34 | osm.query | 34 | osm.query |
35 | osm.update | 35 | osm.update |
36 | " | 36 | ' |
37 | } | 37 | } |
38 | util.osm.edit() { | 38 | util.osm.edit() { |
39 | vim $FILENAME && source $FILENAME | 39 | vim $FILENAME && source $FILENAME |
@@ -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 | ||
46 | #SERVER=https://master.apis.dev.openstreetmap.org | 46 | SERVER=https://master.apis.dev.openstreetmap.org |
47 | SERVER=https://api.openstreetmap.org | 47 | #SERVER=https://api.openstreetmap.org |
48 | OSM_API=$SERVER/api/0.6 | 48 | OSM_API=$SERVER/api/0.6 |
49 | OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm) | 49 | OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm) |
50 | 50 | ||
@@ -112,6 +112,7 @@ osm.list.tags() { | |||
112 | done | 112 | done |
113 | 113 | ||
114 | cat /tmp/osm | 114 | cat /tmp/osm |
115 | echo tag list is also copied into /tmp/osm > /dev/tty | ||
115 | } | 116 | } |
116 | # extract an element from .osm format STDIN | 117 | # extract an element from .osm format STDIN |
117 | # $1 as [node|way|relation], $2 as id | 118 | # $1 as [node|way|relation], $2 as id |
@@ -184,8 +185,10 @@ osm.api.changeset.create() { | |||
184 | echo $info |\ | 185 | echo $info |\ |
185 | curl -u $OSM_USER_PASSWD -i --upload-file - $OSM_API/changeset/create |\ | 186 | curl -u $OSM_USER_PASSWD -i --upload-file - $OSM_API/changeset/create |\ |
186 | tee /dev/tty |\ | 187 | tee /dev/tty |\ |
187 | tail -1 |\ | 188 | tail -1 | read changeset_id |
188 | xsel -ib | 189 | |
190 | echo " copied into clipboard" | ||
191 | echo "changeset created, check $SERVER/changeset/$changeset_id" | ||
189 | } | 192 | } |
190 | # add a new element into changeset | 193 | # add a new element into changeset |
191 | osm.api.changeset.add() { | 194 | osm.api.changeset.add() { |