aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--utils/osm19
1 files changed, 8 insertions, 11 deletions
diff --git a/utils/osm b/utils/osm
index 7f08a98..5fd5798 100644
--- a/utils/osm
+++ b/utils/osm
@@ -29,10 +29,10 @@ COMMANDS:
29 osm.list.tags 29 osm.list.tags
30 30
31 osm.get.id 31 osm.get.id
32 osm.query
32 osm.member.relation 33 osm.member.relation
33 osm.pbf.update 34 osm.pbf.update
34 osm.query 35 osm.osm.update
35 osm.update
36 ' 36 '
37} 37}
38util.osm.edit() { 38util.osm.edit() {
@@ -160,7 +160,7 @@ osm.file.get.full() {
160 osmium getid $file $@ --output-format=osm --add-referenced 160 osmium getid $file $@ --output-format=osm --add-referenced
161} 161}
162# $1 as osm file, $2 as diff file 162# $1 as osm file, $2 as diff file
163osm.update() { 163osm.osm.update() {
164 while read -r line 164 while read -r line
165 do 165 do
166 array=( $(echo $line) ) 166 array=( $(echo $line) )
@@ -171,20 +171,12 @@ osm.update() {
171 /<tag k=$array[3]/ !p 171 /<tag k=$array[3]/ !p
172 /<\/$array[1]/ q 172 /<\/$array[1]/ q
173 }" |\ 173 }" |\
174 tee |\
175 awk -F"\"" ' 174 awk -F"\"" '
176 BEGIN{OFS="\""} 175 BEGIN{OFS="\""}
177 {if(NR==1) print $1,$2,$3,$4+1,">"; else print $0} 176 {if(NR==1) print $1,$2,$3,$4+1,">"; else print $0}
178 ' >> $1.updated 177 ' >> $1.updated
179 done 178 done
180} 179}
181# $1 as .osm file $2 as list of change content
182# use Diff upload: POST /api/0.6/changeset/#id/upload maybe?
183osm.osc.create() {
184 echo "<modify>"
185 awk '{print "<" $1 " id=\"" $2 "\" version=\"NONE\""}' $1
186 echo "</modify>"
187}
188# create a new changeset 180# create a new changeset
189osm.api.changeset.create() { 181osm.api.changeset.create() {
190 182
@@ -219,6 +211,11 @@ osm.api.changeset.add() {
219 sed -r "s/^( *<(node|way|relation).*version[^ ]+ )(.*)$/\1changeset=\"$1\">/" | \ 211 sed -r "s/^( *<(node|way|relation).*version[^ ]+ )(.*)$/\1changeset=\"$1\">/" | \
220 curl -X PUT -u $OSM_USER_PASSWD -i -T - $OSM_API/$ele_type/$id 212 curl -X PUT -u $OSM_USER_PASSWD -i -T - $OSM_API/$ele_type/$id
221} 213}
214osm.api.changeset.upload() {
215 cat $2 |\
216 sed -r "/<(node|way|relation)/ s/>/ changeset=\"$1\">/"
217 #curl -X POST -u $OSM_USER_PASSWD -T - $OSM_API/changeset/$id/upload
218}
222# update changeset with a new comment 219# update changeset with a new comment
223osm.api.changeset.update() { 220osm.api.changeset.update() {
224 echo -n 'type comment: ' 221 echo -n 'type comment: '