forked from openpolis/geojson-italy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_topojson.sh
executable file
·42 lines (35 loc) · 1.4 KB
/
generate_topojson.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -o errexit
set -o nounset
IFS='
'
CDPATH= cd -- "$(dirname -- "$0")"
mapshaper \
-i comuni.geojson -clean encoding=utf8 \
-simplify 20% weighted \
-o topojson/limits_IT_municipalities.topo.json bbox format=topojson
mapshaper \
-i topojson/limits_IT_municipalities.topo.json -clean encoding=utf8 \
-rename-layers municipalities \
-dissolve prov_istat_code + \
copy-fields=prov_name,prov_istat_code_num,prov_acr,reg_name,reg_istat_code,reg_istat_code_num name=provinces \
-target 1 \
-dissolve reg_istat_code + \
copy-fields=reg_name,reg_istat_code_num name=regions \
-target 1 \
-o topojson/limits_IT_all.topo.json bbox format=topojson target=regions,provinces,municipalities \
-o topojson/limits_IT_regions.topo.json bbox format=topojson target=regions \
-o topojson/limits_IT_provinces.topo.json bbox format=topojson target=provinces
for REG in $(seq 1 20); do
mapshaper \
-i topojson/limits_IT_municipalities.topo.json \
-filter reg_istat_code_num==$REG \
-o topojson/limits_R_${REG}_municipalities.topo.json bbox format=topojson
done
for PROV in $(seq 1 111); do
mapshaper \
-i topojson/limits_IT_municipalities.topo.json \
-filter prov_istat_code_num==$PROV \
-rename-layers municipalities target=1 \
-o topojson/limits_P_${PROV}_municipalities.topo.json bbox format=topojson
done