diff options
| author | typebrook <typebrook@gmail.com> | 2019-11-18 14:50:06 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2019-11-18 14:50:06 +0800 |
| commit | cc036aeb915a7a282a66fe21f9b30668336b6c96 (patch) | |
| tree | 8f468218aac128e5346091d42fcb7812049a7512 /scripts/osm | |
| parent | 877ae178585263ef966b67d251665fbc48739e97 (diff) | |
update
Diffstat (limited to 'scripts/osm')
| -rwxr-xr-x | scripts/osm/osm.api.referenced.way | 8 | ||||
| -rwxr-xr-x | scripts/osm/osm.goto | 4 | ||||
| -rwxr-xr-x | scripts/osm/osm.list.tag | 18 | ||||
| -rwxr-xr-x | scripts/osm/osm.list.tags | 24 | ||||
| -rwxr-xr-x | scripts/osm/osm.osm.remove | 16 | ||||
| -rwxr-xr-x | scripts/osm/osm.query | 4 |
6 files changed, 43 insertions, 31 deletions
diff --git a/scripts/osm/osm.api.referenced.way b/scripts/osm/osm.api.referenced.way index b62ac58..1d84238 100755 --- a/scripts/osm/osm.api.referenced.way +++ b/scripts/osm/osm.api.referenced.way | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | curl -X GET $OSM_API/node/$1/ways |\ | 1 | #!/bin/bash |
| 2 | tee /tmp/osm &&\ | 2 | |
| 3 | echo ways contain node $1 are copied into /tmp/osm > /dev/tty | 3 | curl -X GET $OSM_API/node/$1/ways |\ |
| 4 | tee /tmp/osm &&\ | ||
| 5 | echo ways contain node $1 are copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.goto b/scripts/osm/osm.goto index 7da3394..25bceaa 100755 --- a/scripts/osm/osm.goto +++ b/scripts/osm/osm.goto | |||
| @@ -1 +1,3 @@ | |||
| 1 | xdg-open https://www.openstreetmap.org/$1/$2 | 1 | #!/bin/sh |
| 2 | |||
| 3 | xdg-open https://www.openstreetmap.org/$1/$2 | ||
diff --git a/scripts/osm/osm.list.tag b/scripts/osm/osm.list.tag index 3d5157d..76649a0 100755 --- a/scripts/osm/osm.list.tag +++ b/scripts/osm/osm.list.tag | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | ele_pattern="(node|way|relation)" | 1 | #!/bin/bash |
| 2 | sed -nr "/<$ele_pattern/,/<\/$ele_pattern/ { | 2 | |
| 3 | /<tag k=\"$1\"/ { | 3 | ele_pattern="(node|way|relation)" |
| 4 | s/.*v=\"([^\"]+)\".*/\1/ | 4 | sed -nr "/<$ele_pattern/,/<\/$ele_pattern/ { |
| 5 | h | 5 | /<tag k=\"$1\"/ { |
| 6 | } | 6 | s/.*v=\"([^\"]+)\".*/\1/ |
| 7 | /<\/$ele_pattern/ {x;p;s/.*//;x} | 7 | h |
| 8 | }" | 8 | } |
| 9 | /<\/$ele_pattern/ {x;p;s/.*//;x} | ||
| 10 | }" | ||
diff --git a/scripts/osm/osm.list.tags b/scripts/osm/osm.list.tags index 6fe4da4..767d32a 100755 --- a/scripts/osm/osm.list.tags +++ b/scripts/osm/osm.list.tags | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | content=$(cat) | 1 | #!/bin/bash |
| 2 | echo $content | osm.list.ids | tr ' ' ',' > /tmp/osm | ||
| 3 | 2 | ||
| 4 | for tag in $@ | 3 | content=$(cat) |
| 5 | do | 4 | echo $content | osm.list.ids | tr ' ' ',' > /tmp/osm |
| 6 | echo $content |\ | ||
| 7 | osm.list.tag $tag |\ | ||
| 8 | paste -d',' /tmp/osm - > /tmp/osm.new &&\ | ||
| 9 | mv /tmp/osm.new /tmp/osm | ||
| 10 | done | ||
| 11 | 5 | ||
| 12 | cat /tmp/osm | 6 | for tag in $@ |
| 13 | echo "\ntag list is also copied into /tmp/osm" > /dev/tty | 7 | do |
| 8 | echo $content |\ | ||
| 9 | osm.list.tag $tag |\ | ||
| 10 | paste -d',' /tmp/osm - > /tmp/osm.new &&\ | ||
| 11 | mv /tmp/osm.new /tmp/osm | ||
| 12 | done | ||
| 13 | |||
| 14 | cat /tmp/osm | ||
| 15 | echo "\ntag list is also copied into /tmp/osm" > /dev/tty | ||
diff --git a/scripts/osm/osm.osm.remove b/scripts/osm/osm.osm.remove index fbbaf0c..83d6ea8 100755 --- a/scripts/osm/osm.osm.remove +++ b/scripts/osm/osm.osm.remove | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | while read -r line | 1 | #!/bin/bash |
| 2 | do | 2 | |
| 3 | # put element type and element ID into array | 3 | while read -r line |
| 4 | array=( $(echo $line) ) | 4 | do |
| 5 | cat $1 |\ | 5 | # put element type and element ID into array |
| 6 | sed -i "/<$array[1] id=\"$array[2]\"/,/<\/$array[1]>/ d" | 6 | array=( $(echo $line) ) |
| 7 | done | 7 | cat $1 |\ |
| 8 | sed -i "/<$array[1] id=\"$array[2]\"/,/<\/$array[1]>/ d" | ||
| 9 | done | ||
diff --git a/scripts/osm/osm.query b/scripts/osm/osm.query index fd48fd2..8d0b9f7 100755 --- a/scripts/osm/osm.query +++ b/scripts/osm/osm.query | |||
| @@ -1 +1,3 @@ | |||
| 1 | osmium tags-filter - $@ --input-format=osm --output-format=osm --omit-referenced | 1 | #!/bin/bash |
| 2 | |||
| 3 | osmium tags-filter - $@ --input-format=osm --output-format=osm --omit-referenced | ||