diff options
-rw-r--r-- | utils/osm.village.nat_ref.makefile | 13 |
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 | |||
20 | village.no_nat_ref.csv: village.csv | 20 | village.no_nat_ref.csv: village.csv |
21 | grep -v nat_ref $< > $@ | 21 | grep -v nat_ref $< > $@ |
22 | 22 | ||
23 | village.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 | |||
23 | matched.csv: data/VILLAGE_MOI_1081007.shp village.no_nat_ref.csv | 28 | matched.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 | ||
36 | matched.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 | |||
31 | confilct.list: matched.csv | 44 | confilct.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 | ||