diff options
Diffstat (limited to 'utils/osm')
| -rw-r--r-- | utils/osm | 15 |
1 files changed, 9 insertions, 6 deletions
| @@ -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 | ||
| @@ -57,17 +57,19 @@ osm.api.fetch() { | |||
| 57 | osm.api.fetch.full() { | 57 | osm.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 | } |
| 62 | osm.api.fetch.history() { | 62 | osm.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 | } |
| 67 | osm.api.referenced.relation() { | 68 | osm.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 | } |
| 72 | osm.member.relation() { | 74 | osm.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 |
| 202 | osm.api.changeset.add() { | 205 | osm.api.changeset.add() { |