-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathother_area.sh
executable file
·151 lines (137 loc) · 3.93 KB
/
other_area.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# Copyright 2011 Luca Delucchi
#
#
# This program is free software; you can redistribute it and/or odify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# For large area 10GB could be not enough
: ${XMX:=8000M}
NO_ARG=0
#percorso al directory di lavoro
#bisogna lanciare il comando dalla directory di italimg.sh
MYPATH=`pwd`
### FUNZIONE PER L'HELP ##
usage()
{
echo "Utilizzo: `basename $0` opzioni file.osm.bz2/pbf
Opzioni:
-o osm file not compressed
-p usa file pbf
"
}
#controlla se non ci sono parametri ed stampa l'help
if [ $# -eq "$NO_ARG" ]
then
usage
exit
fi
if [ $# -eq "1" ]
then
file_in=$1;
name_nation=`echo $1 | cut -d'.' -f'1' | rev | cut -d"/" -f"1" | rev;`
elif [ $# -eq "2" ]
then
file_in=$2;
name_nation=`echo $2 | cut -d'.' -f'1' | rev | cut -d"/" -f"1" | rev;`
fi
#####VARIABILI DA SETTARE#####
#nome della zona rappresentata
name=$name_nation
#abbreviazione della zona
#abbr="IT"
#nome dello style
style_it="styles/gfoss"
style_escu="styles/hiking"
mkgmap="mkgmap-r4916"
splitter="splitter-r653"
#nome della mappa
serie=${name_nation}" creata da ital.img"
#assegna il livello della mappa se sul dispositivo sono presenti più mappe
priority="10"
##### SCRIP #####
function create()
{
if [ "$EXT" = bz2 ] ; then
bzcat $file_in > ${name_nation}.osm
fi
### CREA IL FILE DELLA NAZIONE ###
#divide il file osm, se si cambia regione ricordarsi di cambiare il nome
if [ "$EXT" = bz2 -o "$EXT" = osm ] ; then
java -Xmx${XMX} -jar ${MYPATH}/${splitter}/splitter.jar --max-areas=4096 --max-nodes=3000000 --wanted-admin-level=8 --geonames-file=cities15000.txt ${name_nation}.osm
else
java -Xmx${XMX} -jar ${MYPATH}/${splitter}/splitter.jar --max-areas=4096 --max-nodes=3000000 --wanted-admin-level=8 --geonames-file=cities15000.txt $file_in
fi
#crea il file img
java -Xmx${XMX} -jar ${MYPATH}/${mkgmap}/mkgmap.jar \
--style-file=$style_it \
--latin1 \
--country-name=Italia \
--country-abbr="$name_nation" \
--region-name="$name_nation" \
--area-name="$name_nation" \
--family-name="OpenStreetMap: $name_nation" \
--description="$name_nation" \
--precomp-sea=${MYPATH}/sea/ \
--generate-sea \
--bounds=${MYPATH}/bounds/ \
--max-jobs \
--route \
--drive-on=detect,right \
--process-destination \
--process-exits \
--location-autofill=is_in,nearest \
--index \
--split-name-index \
--housenumbers \
--add-pois-to-areas \
--link-pois-to-ways \
--preserve-element-order \
--verbose \
--name-tag-list=name,name:it,loc_name,reg_name,nat_name \
--draw-priority=$priority \
--reduce-point-density=3.2 \
--make-opposite-cycleways \
--keep-going \
--gmapsupp \
6*.osm.pbf
tar -cf ${MYPATH}/output_img/${name_nation}.tar gmapsupp.img ${MYPATH}/README_data.txt
gzip -9 -f ${MYPATH}/output_img/${name_nation}.tar
}
#ciclo per vedere le opzioni scelte
while getopts ":po" Opzione
do
case $Opzione in
#scarica file pbf invece che bz2
p ) PBF=1;;
#scarica file pbf invece che bz2
o ) OSM=1;;
esac
done
#controlla se scaricare bz2 o pbf
if [ "$PBF" ] ; then
EXT=pbf
elif [ "$OSM" ]; then
EXT=osm
else
EXT=bz2
fi
echo $EXT
create
#rimuove tutti i file non più utili
# rm -rf 632400*
# rm -rf *.img
# rm -rf *.IMG
# rm -rf *.osm