From e0f1d52286583df3c618d803ac8ad90d53017b62 Mon Sep 17 00:00:00 2001 From: Ducky Date: Mon, 2 Oct 2023 21:02:05 +0100 Subject: [PATCH] osm-garmin: add ability to set country abbr and name; add house numbers to built maps --- osm-garmin/app/build-gmap.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/osm-garmin/app/build-gmap.sh b/osm-garmin/app/build-gmap.sh index 3fc8ffe..02672e7 100755 --- a/osm-garmin/app/build-gmap.sh +++ b/osm-garmin/app/build-gmap.sh @@ -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