diff options
| -rw-r--r-- | alias | 2 | ||||
| -rwxr-xr-x | scripts/osm/osm.osc.by_member | 31 | ||||
| -rwxr-xr-x | scripts/osm/osm.osm.by_tag (renamed from scripts/osm/osm.osc.create) | 0 | ||||
| -rw-r--r-- | scripts/osm/osm.village.nat_ref.makefile | 7 |
4 files changed, 39 insertions, 1 deletions
| @@ -210,7 +210,7 @@ mvt_decode() { | |||
| 210 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . | 210 | python3 $SETTING_DIR/scripts/mvt_decode.py $1 | tr \' \" | sed 's/True/true/g' | jq . |
| 211 | } | 211 | } |
| 212 | big52utf8() { | 212 | big52utf8() { |
| 213 | iconv -f BIG-5 -t UTF-8 $1 > $1.utf8 | 213 | iconv -f BIG-5 -t UTF-8 |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | # tmp | 216 | # tmp |
diff --git a/scripts/osm/osm.osc.by_member b/scripts/osm/osm.osc.by_member new file mode 100755 index 0000000..5f9d9be --- /dev/null +++ b/scripts/osm/osm.osc.by_member | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | while read -r line | ||
| 4 | do | ||
| 5 | |||
| 6 | TYPE=$(echo $line | cut -d ' ' -f1) # field1 is type | ||
| 7 | ID=$(echo $line | cut -d ' ' -f2) # field2 is ID | ||
| 8 | |||
| 9 | NEW_MEMBERS=$(echo $line |\ | ||
| 10 | cut -d' ' -f3- |\ | ||
| 11 | sed -r 's/([0-9]+)/<member type=\"relation\" ref=\"\1\" role=\"subarea\"\/>/g') | ||
| 12 | |||
| 13 | echo $NEW_MEMBERS | ||
| 14 | |||
| 15 | # print matched element with new tags to .osc file | ||
| 16 | cat $1 |\ | ||
| 17 | sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { | ||
| 18 | /<$TYPE id=\"$ID\"/ { | ||
| 19 | s/(version=\"[0-9]+\")(.*)/\1>/ | ||
| 20 | a \ \ \ \ $NEW_MEMBERS | ||
| 21 | } | ||
| 22 | p | ||
| 23 | /<\/$TYPE/ q | ||
| 24 | }" >> $1.osc | ||
| 25 | done | ||
| 26 | |||
| 27 | # Add .osc structure for output | ||
| 28 | sed -ir '1 i <osmChange version="0.6" generator="bash script"> | ||
| 29 | 1 i <modify> | ||
| 30 | $ a </modify> | ||
| 31 | $ a </osmChange>' $1.osc | ||
diff --git a/scripts/osm/osm.osc.create b/scripts/osm/osm.osm.by_tag index cc92c1d..cc92c1d 100755 --- a/scripts/osm/osm.osc.create +++ b/scripts/osm/osm.osm.by_tag | |||
diff --git a/scripts/osm/osm.village.nat_ref.makefile b/scripts/osm/osm.village.nat_ref.makefile index cfaf92a..a051ee4 100644 --- a/scripts/osm/osm.village.nat_ref.makefile +++ b/scripts/osm/osm.village.nat_ref.makefile | |||
| @@ -19,6 +19,13 @@ village.csv: data/taiwan-latest.osm.pbf | |||
| 19 | FROM multipolygons \ | 19 | FROM multipolygons \ |
| 20 | WHERE admin_level = '9'" | 20 | WHERE admin_level = '9'" |
| 21 | 21 | ||
| 22 | town.csv: data/taiwan-latest.osm.pbf | ||
| 23 | ogr2ogr $@ $< \ | ||
| 24 | -dialect sqlite \ | ||
| 25 | -sql "SELECT osm_id, name, other_tags \ | ||
| 26 | FROM multipolygons \ | ||
| 27 | WHERE admin_level = '5' OR admin_level = '7' OR admin_level = '8'" | ||
| 28 | |||
| 22 | village.no_nat_ref.csv: village.csv | 29 | village.no_nat_ref.csv: village.csv |
| 23 | grep -v nat_ref $< > $@ | 30 | grep -v nat_ref $< > $@ |
| 24 | 31 | ||