diff options
Diffstat (limited to 'utils/osm')
-rw-r--r-- | utils/osm | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -44,9 +44,9 @@ osm.goto() { | |||
44 | xdg-open https://www.openstreetmap.org/$1/$2 | 44 | xdg-open https://www.openstreetmap.org/$1/$2 |
45 | } | 45 | } |
46 | 46 | ||
47 | #SERVER=https://master.apis.dev.openstreetmap.org | 47 | #OSM_SERVER=https://master.apis.dev.openstreetmap.org |
48 | SERVER=https://api.openstreetmap.org | 48 | OSM_SERVER=https://api.openstreetmap.org |
49 | OSM_API=$SERVER/api/0.6 | 49 | OSM_API=$OSM_SERVER/api/0.6 |
50 | OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm) | 50 | OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm) |
51 | 51 | ||
52 | # get .osm format data | 52 | # get .osm format data |
@@ -200,7 +200,7 @@ osm.api.changeset.create() { | |||
200 | tail -1 | read changeset_id | 200 | tail -1 | read changeset_id |
201 | 201 | ||
202 | echo " copied into clipboard" | 202 | echo " copied into clipboard" |
203 | echo "changeset created, check $SERVER/changeset/$changeset_id" | 203 | echo "changeset created, check $OSM_SERVER/changeset/$changeset_id" |
204 | echo $changeset_id | xsel -ib | 204 | echo $changeset_id | xsel -ib |
205 | } | 205 | } |
206 | # add a new element into changeset | 206 | # add a new element into changeset |
@@ -234,7 +234,7 @@ osm.api.changeset.close() { | |||
234 | # update an .osm.pbf file | 234 | # update an .osm.pbf file |
235 | osm.pbf.update() { | 235 | osm.pbf.update() { |
236 | PBF_FILE=$1 | 236 | PBF_FILE=$1 |
237 | SERVER=http://download.geofabrik.de/asia/taiwan-updates | 237 | GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates |
238 | 238 | ||
239 | # get next sequence number and store it into NEW_SEQ | 239 | # get next sequence number and store it into NEW_SEQ |
240 | osmium fileinfo $PBF_FILE | \ | 240 | osmium fileinfo $PBF_FILE | \ |
@@ -247,11 +247,12 @@ osm.pbf.update() { | |||
247 | # get it and do file update | 247 | # get it and do file update |
248 | while | 248 | while |
249 | SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') | 249 | SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') |
250 | STATE_URL=$SERVER/000/$SEQ_PATH.state.txt | 250 | STATE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.state.txt |
251 | echo $STATE_URL | ||
251 | [ $(curl.code $STATE_URL) != "404" ] | 252 | [ $(curl.code $STATE_URL) != "404" ] |
252 | do | 253 | do |
253 | mkdir -p changes | 254 | mkdir -p changes |
254 | CHANGE_URL=$SERVER/000/$SEQ_PATH.osc.gz | 255 | CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz |
255 | echo $CHANGE_URL | 256 | echo $CHANGE_URL |
256 | curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \ | 257 | curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \ |
257 | osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \ | 258 | osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \ |