aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/osm/osm.api.changeset.commit
diff options
context:
space:
mode:
Diffstat (limited to 'tools/osm/osm.api.changeset.commit')
-rwxr-xr-xtools/osm/osm.api.changeset.commit11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/osm/osm.api.changeset.commit b/tools/osm/osm.api.changeset.commit
index 20ec2f0..a16da63 100755
--- a/tools/osm/osm.api.changeset.commit
+++ b/tools/osm/osm.api.changeset.commit
@@ -39,6 +39,14 @@ create_changeset() {
39EOF 39EOF
40} 40}
41 41
42# Return http code after uploading a file
43uploade_file_to_changeset() {
44 curl $OSM_API/changeset/${changeset_id}/upload \
45 --user ${OSM_USER_PASSWD} -i \
46 --upload-file - \
47 --silent -o /dev/null -w "%{http_code}"
48}
49
42# Create changeset with given information 50# Create changeset with given information
43changeset_id=$(create_changeset) 51changeset_id=$(create_changeset)
44 52
@@ -49,8 +57,7 @@ echo ${changeset_id}
49 57
50# Upload OSC file to Changeset 58# Upload OSC file to Changeset
51sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\ 59sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\
52tee /dev/tty | \ 60uploade_file_to_changeset | if [[ $(cat) != '200' ]]; then exit 1; fi
53curl -X POST --user ${OSM_USER_PASSWD} -i --upload-file - $OSM_API/changeset/${changeset_id}/upload
54 61
55# Close Changeset 62# Close Changeset
56curl -X PUT --user ${OSM_USER_PASSWD} -i ${OSM_API}/changeset/${changeset_id}/close 63curl -X PUT --user ${OSM_USER_PASSWD} -i ${OSM_API}/changeset/${changeset_id}/close