summaryrefslogtreecommitdiffhomepage
path: root/scripts/osm/osm.osc.create
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/osm/osm.osc.create')
-rwxr-xr-xscripts/osm/osm.osc.create42
1 files changed, 27 insertions, 15 deletions
diff --git a/scripts/osm/osm.osc.create b/scripts/osm/osm.osc.create
index 61a4dfb..c9bdaa8 100755
--- a/scripts/osm/osm.osc.create
+++ b/scripts/osm/osm.osc.create
@@ -1,17 +1,29 @@
1 while read -r line 1#!/bin/bash
2 do
3 array=( $(echo $line) )
4 2
5 cat $1 |\ 3while read -r line
6 sed -nr " 4do
7 /<$array[1] id=$array[2]/,/<\/$array[1]/ { 5 TYPE=$(echo $line | cut -d ' ' -f1)
8 /<$array[1] id=$array[2]/ a \ \ \ \ <tag k=\"$array[3]\" v=$array[4]\/> 6 ID=$(echo $line | cut -d ' ' -f2)
9 /<tag k=$array[3]/ !p 7 NEW_TAGS=$(echo $line |\
10 /<\/$array[1]/ q 8 cut -d' ' -f3- | xargs -n2 echo |\
11 }" >> $1.osc 9 sed -r 's/^([^ ]+) (.+)/<tag k=\"\1\" v=\"\2\"\/>/' |\
12 done 10 paste -s)
13 11
14 sed -ir '1 i <osmChange version="0.6" generator="bash script"> 12 TAG_PATTERN=$(echo $line |\
15 1 i <modify> 13 cut -d' ' -f3- | xargs -n2 echo |\
16 $ a </modify> 14 cut -d' ' -f1 | paste -s -d'|')
17 $ a </osmChange>' $1.osc 15
16 echo $TAG_PATTERN > /dev/tty
17
18 cat $1 |\
19 sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ {
20 /<$TYPE id=\"$ID\"/ a \ \ \ \ $NEW_TAGS
21 /<tag k=\"($TAG_PATTERN)\"/ !p
22 /<\/$TYPE/ q
23 }" >> $1.osc
24done
25
26sed -ir '1 i <osmChange version="0.6" generator="bash script">
27 1 i <modify>
28 $ a </modify>
29 $ a </osmChange>' $1.osc