2
0
Fork 0

osm-garmin: add ability to set country abbr and name; add house numbers to built maps

main
Ducky 2023-10-02 21:02:05 +01:00
parent 3a91128f30
commit e0f1d52286
1 changed files with 19 additions and 1 deletions

View File

@ -16,6 +16,8 @@ function build_gmap() {
region="$1"
region_id="$2"
style="$3"
country_abbr="$4"
country_name="$5"
region_shortname="$(get_region_shortname "$region")"
generated_map_dir="$out_dir/$region_shortname/"
@ -40,6 +42,9 @@ function build_gmap() {
mkdir -p "$generated_map_dir"
[[ -z "$country_abbr" ]] && country_abbr="ZZ"
[[ -z "$country_name" ]] && country_name="Unknown"
if [[ -f "$version_path" ]]; then
if [[ $(cat "$version_path") == "$version" ]]; then
build="false"
@ -53,6 +58,9 @@ function build_gmap() {
--description="$(echo "${region##*/}" | sed -e "s/-/ /g" | sed -e "s/\b\(.\)/\u\1/g" | sed -e "s/ /-/g")" \
--add-pois-to-areas \
--bounds="$bounds_dir" \
--country-abbr="$country_abbr" \
--country-name="$country_name" \
--housenumbers \
--index \
--route \
--gmapsupp \
@ -123,6 +131,9 @@ mkdir -p "$maps_dir"
mkdir -p "$out_dir"
mkdir -p "$tiles_dir"
[[ -n "$regions" ]] && die "No regions given (1st argument)"
[[ -n "$style" ]] && die "No style given (2nd argument)"
regions_array="$(echo $regions | tr ";" "\n")"
is_updates="false"
@ -130,6 +141,8 @@ is_updates="false"
if [[ $OSMGARMIN_SKIP_UPDATE_MAPS != "true" ]]; then
for region in $regions_array; do
region="$(echo "$region" | cut -d':' -f1)"
if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then
if [[ "$(check_osm_update "$region")" == "true" ]]; then
echo "🌍 Updating OSM map: $region"
@ -159,9 +172,14 @@ if [[ $is_updates == "true" ]]; then
region_id=1
for region in $regions_array; do
region="$(echo "$region" | cut -d':' -f1)"
region_attr="$(echo "$region" | cut -d':' -f2)"
region_country_abbr="$(echo "$region_attr" | cut -d',' -f1)"
region_country_name="$(echo "$region_attr" | cut -d',' -f2)"
if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then
echo "🔨 Building Garmin map: $region"
build_gmap "$region" "$region_id" "$style"
build_gmap "$region" "$region_id" "$style" "$region_country_abbr" "$region_country_name"
((region_id++))
fi
done