aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-11-16 15:39:02 +0800
committertypebrook <typebrook@gmail.com>2019-11-16 15:39:02 +0800
commitbd82900e7cfcba62db788e87b8056a4b6d80c74e (patch)
tree327739c76991e18208fa176a4b58c7d3b964ac94
parentd895076b6d1959cf8ad4396279dda800d4b606d7 (diff)
update
-rw-r--r--utils/osm.village.nat_ref.makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/osm.village.nat_ref.makefile b/utils/osm.village.nat_ref.makefile
index 5f59c02..fefeeaa 100644
--- a/utils/osm.village.nat_ref.makefile
+++ b/utils/osm.village.nat_ref.makefile
@@ -20,6 +20,11 @@ village.csv: data/taiwan-latest.osm.pbf
20village.no_nat_ref.csv: village.csv 20village.no_nat_ref.csv: village.csv
21 grep -v nat_ref $< > $@ 21 grep -v nat_ref $< > $@
22 22
23village.with_nat_ref.csv: village.csv
24 (head -1 $<; grep nat_ref $<) |\
25 sed -r "s/\"\"\".*nat_ref\"\"=>\"\"([^\"]+).*\"\"\"/\1/g" |\
26 sed '1s/other_tags/nat_ref/'> $@
27
23matched.csv: data/VILLAGE_MOI_1081007.shp village.no_nat_ref.csv 28matched.csv: data/VILLAGE_MOI_1081007.shp village.no_nat_ref.csv
24 ogr2ogr $@ $(word 2,$^) \ 29 ogr2ogr $@ $(word 2,$^) \
25 -oo X_POSSIBLE_NAMES=X -oo Y_POSSIBLE_NAMES=Y \ 30 -oo X_POSSIBLE_NAMES=X -oo Y_POSSIBLE_NAMES=Y \
@@ -28,6 +33,14 @@ matched.csv: data/VILLAGE_MOI_1081007.shp village.no_nat_ref.csv
28 FROM 'village.no_nat_ref' osm, '$<'.VILLAGE_MOI_1081007 gov \ 33 FROM 'village.no_nat_ref' osm, '$<'.VILLAGE_MOI_1081007 gov \
29 WHERE osm.name = gov.VILLNAME AND Intersects(gov.geometry, osm.geometry)" 34 WHERE osm.name = gov.VILLNAME AND Intersects(gov.geometry, osm.geometry)"
30 35
36matched.by_ref.csv: data/VILLAGE_MOI_1081007.shp village.with_nat_ref.csv
37 ogr2ogr $@ $(word 2,$^) \
38 -oo X_POSSIBLE_NAMES=X -oo Y_POSSIBLE_NAMES=Y \
39 -dialect sqlite \
40 -sql "SELECT osm.osm_id, gov.* \
41 FROM 'village.with_nat_ref' osm, '$<'.VILLAGE_MOI_1081007 gov \
42 WHERE osm.nat_ref = gov.VILLCODE"
43
31confilct.list: matched.csv 44confilct.list: matched.csv
32 cat $< | cut -d',' -f2 | sort | uniq -d | xargs -I {} grep {} $< 45 cat $< | cut -d',' -f2 | sort | uniq -d | xargs -I {} grep {} $<
33 46