From 260250f716741cea815d8a3cf99fd9b59dd50f64 Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 8 Nov 2019 13:39:16 +0800 Subject: update --- utils/osm.utils.sh | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'utils/osm.utils.sh') diff --git a/utils/osm.utils.sh b/utils/osm.utils.sh index 68f7f54..3eed4be 100644 --- a/utils/osm.utils.sh +++ b/utils/osm.utils.sh @@ -11,8 +11,24 @@ OSM_USER_PASSWD=$(cat $HOME/git/settings/tokens/osm) # get .osm format data osm.get() { - curl -X GET $OSM_API/$1/$2 &&\ - echo $2 copied | xsel -ib + curl -X GET $OSM_API/$1/$2 |\ + tee /tmp/osm &&\ + echo content of $1 $2 is copied into /tmp/osm > /dev/tty +} +osm.get_full() { + curl -X GET $OSM_API/$1/$2/full |\ + tee /tmp/osm &&\ + echo content of $1 $2 and its members are copied into /tmp/osm > /dev/tty +} +osm.in_relations() { + curl -X GET $OSM_API/$1/$2/relations |\ + tee /tmp/osm &&\ + echo relations contain $1 $2 are copied into /tmp/osm > /dev/tty +} +osm.in_ways() { + curl -X GET $OSM_API/node/$1/ways |\ + tee /tmp/osm &&\ + echo ways contain $1 are copied into /tmp/osm > /dev/tty } # extract an element from .osm format STDIN osm.extract() { @@ -34,8 +50,8 @@ osm.upload.to() { sed "s/.*/\0 \| osm.changeset.add $1/g" |\ while read -r command do - cat <(echo "("$command "&)") - #source <(echo $command &) + cat <(echo $command) + source <(echo "("$command " &)") done } # query osm-related file with .osm format output @@ -50,8 +66,13 @@ osm.file.extract() { osm.update() { # remove original tag&value sed "/" + if [ "$2" != "" ]; then + # insert new tag&value + sed -r "/<(node|way|relation)/a \ \ \ \ " + else + # just print it + sed '' + fi } # create a new changeset osm.changeset.create() { -- cgit v1.2.3-70-g09d2