diff options
-rwxr-xr-x | tools/osm/osm.api.changeset.commit | 11 |
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() { | |||
39 | EOF | 39 | EOF |
40 | } | 40 | } |
41 | 41 | ||
42 | # Return http code after uploading a file | ||
43 | uploade_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 |
43 | changeset_id=$(create_changeset) | 51 | changeset_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 |
51 | sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\ | 59 | sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\ |
52 | tee /dev/tty | \ | 60 | uploade_file_to_changeset | if [[ $(cat) != '200' ]]; then exit 1; fi |
53 | curl -X POST --user ${OSM_USER_PASSWD} -i --upload-file - $OSM_API/changeset/${changeset_id}/upload | ||
54 | 61 | ||
55 | # Close Changeset | 62 | # Close Changeset |
56 | curl -X PUT --user ${OSM_USER_PASSWD} -i ${OSM_API}/changeset/${changeset_id}/close | 63 | curl -X PUT --user ${OSM_USER_PASSWD} -i ${OSM_API}/changeset/${changeset_id}/close |