From 9ecac72aef0b51c78822991e614520eb7d004828 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 24 Aug 2020 14:21:27 +0800 Subject: Update OSM commit script --- tools/osm/osm.api.changeset.commit | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'tools/osm/osm.api.changeset.commit') diff --git a/tools/osm/osm.api.changeset.commit b/tools/osm/osm.api.changeset.commit index 356b3da..d41472e 100755 --- a/tools/osm/osm.api.changeset.commit +++ b/tools/osm/osm.api.changeset.commit @@ -1,16 +1,23 @@ #!/bin/sh set -e +shopt -s lastpipe -OSM_API=https://api.openstreetmap.org/api/0.6 +OSM_SERVER=https://api.openstreetmap.org +# Test server, use it for debug +#OSM_SERVER=https://master.apis.dev.openstreetmap.org +OSM_API=${OSM_SERVER}/api/0.6 + +# Prompt for comment and User:Password read -e -p 'Type comment: ' -r comment @@ -19,11 +26,24 @@ info=" " -changeset_id=$(<<<"${info}" curl -u ${OSM_USER_PASSWD} --upload-file - ${OSM_API}/changeset/create | tail -1) - +# Create changeset with given information +curl ${OSM_API}/changeset/create \ + --user ${OSM_USER_PASSWD} \ + --upload-file - \ + < + + + + + + +EOF + +# Print created changeset id echo >/dev/tty -echo "changeset created, check $OSM_SERVER/changeset/${changeset_id}" >/dev/tty -echo $changeset_id +echo "changeset created, check ${OSM_SERVER}/changeset/${changeset_id}" >/dev/tty +echo ${changeset_id} # Upload OSC file to Changeset sed -r "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" <$1 |\ -- cgit v1.2.3-70-g09d2