diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/csv.move_column (renamed from scripts/csv/csv.move_column) | 0 | ||||
| -rwxr-xr-x | scripts/csv.reorder (renamed from scripts/csv/csv.reorder) | 0 | ||||
| -rwxr-xr-x | scripts/csv2geojson (renamed from scripts/csv/csv2geojson) | 0 | ||||
| -rwxr-xr-x | scripts/osm/osm.pbf.update | 56 |
4 files changed, 29 insertions, 27 deletions
diff --git a/scripts/csv/csv.move_column b/scripts/csv.move_column index a62701f..a62701f 100755 --- a/scripts/csv/csv.move_column +++ b/scripts/csv.move_column | |||
diff --git a/scripts/csv/csv.reorder b/scripts/csv.reorder index df928f1..df928f1 100755 --- a/scripts/csv/csv.reorder +++ b/scripts/csv.reorder | |||
diff --git a/scripts/csv/csv2geojson b/scripts/csv2geojson index 085e12e..085e12e 100755 --- a/scripts/csv/csv2geojson +++ b/scripts/csv2geojson | |||
diff --git a/scripts/osm/osm.pbf.update b/scripts/osm/osm.pbf.update index 694ae4d..599076f 100755 --- a/scripts/osm/osm.pbf.update +++ b/scripts/osm/osm.pbf.update | |||
| @@ -1,30 +1,32 @@ | |||
| 1 | PBF_FILE=$1 | 1 | #!/bin/sh |
| 2 | GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates | ||
| 3 | 2 | ||
| 4 | # get next sequence number and store it into NEW_SEQ | 3 | PBF_FILE=$1 |
| 5 | osmium fileinfo $PBF_FILE | \ | 4 | GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates |
| 6 | grep osmosis_replication_sequence_number | \ | ||
| 7 | cut -d'=' -f2 | \ | ||
| 8 | sed 's/$/+1/' | bc | \ | ||
| 9 | read NEW_SEQ | ||
| 10 | 5 | ||
| 11 | # while server has osc file with given sequence number, | 6 | # get next sequence number and store it into NEW_SEQ |
| 12 | # get it and do file update | 7 | osmium fileinfo $PBF_FILE | \ |
| 13 | while | 8 | grep osmosis_replication_sequence_number | \ |
| 14 | SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') | 9 | cut -d'=' -f2 | \ |
| 15 | STATE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.state.txt | 10 | sed 's/$/+1/' | bc | \ |
| 16 | echo $STATE_URL | 11 | read NEW_SEQ |
| 17 | [ $(curl.code $STATE_URL) != "404" ] | ||
| 18 | do | ||
| 19 | mkdir -p changes | ||
| 20 | CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz | ||
| 21 | echo $CHANGE_URL | ||
| 22 | curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \ | ||
| 23 | osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \ | ||
| 24 | --output-header=osmosis_replication_sequence_number=$NEW_SEQ \ | ||
| 25 | --overwrite \ | ||
| 26 | --output $NEW_SEQ.osm.pbf | ||
| 27 | 12 | ||
| 28 | PBF_FILE=$NEW_SEQ.osm.pbf | 13 | # while server has osc file with given sequence number, |
| 29 | ((NEW_SEQ++)) | 14 | # get it and do file update |
| 30 | done | 15 | while |
| 16 | SEQ_PATH=$(echo $NEW_SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') | ||
| 17 | STATE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.state.txt | ||
| 18 | echo $STATE_URL | ||
| 19 | [ $(curl.code $STATE_URL) != "404" ] | ||
| 20 | do | ||
| 21 | mkdir -p changes | ||
| 22 | CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz | ||
| 23 | echo $CHANGE_URL | ||
| 24 | curl -o changes/$NEW_SEQ.osc.gz $CHANGE_URL && \ | ||
| 25 | osmium apply-changes $PBF_FILE changes/$NEW_SEQ.osc.gz \ | ||
| 26 | --output-header=osmosis_replication_sequence_number=$NEW_SEQ \ | ||
| 27 | --overwrite \ | ||
| 28 | --output $NEW_SEQ.osm.pbf | ||
| 29 | |||
| 30 | PBF_FILE=$NEW_SEQ.osm.pbf | ||
| 31 | ((NEW_SEQ++)) | ||
| 32 | done | ||