diff options
| author | Hsieh Chin Fan <typebrook@gmail.com> | 2021-03-13 16:47:36 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <typebrook@gmail.com> | 2021-03-13 16:47:36 +0800 |
| commit | 67477231ce35b8c875217ce8bdae799e4cd4075c (patch) | |
| tree | 6754c464cecf0677762c91639362bb496a3f32f9 /tools/osm | |
| parent | 690032f8bd081c6d15e12d1ef97c4ab96b4ad49e (diff) | |
update
Diffstat (limited to 'tools/osm')
| -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 |