2
0
Fork 0

osm-garmin: improve performance

main
Ducky 2023-09-26 04:01:15 +01:00
parent dd11cc0f98
commit 3a68e552ca
2 changed files with 27 additions and 26 deletions

View File

@ -2,7 +2,7 @@
. /app/utils.sh
region="$1"
regions="$1"
style="$2"
cwd="$(pwd)"
@ -87,7 +87,7 @@ function update_bounds() {
}
download_bounds "bounds"
#download_bounds "sea"
download_bounds "sea"
}
function update_osm_map() {
@ -121,26 +121,35 @@ if [[ -z $region ]]; then
die "No region specified"
fi
if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then
echo "👀 Checking for OSM updates..."
if [[ "$(check_osm_update "$region")" == "true" ]]; then
[[ $? != 0 ]] && die "Region \"$region\" does not exist"
regions_array="$(echo $regions | tr ";" "\n")"
for region in $regions_array; do
if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then
echo "👀 Checking OSM updates: $region"
if [[ "$(check_osm_update "$region")" == "true" ]]; then
echo "🌍 Updating OSM map: $region"
update_osm_map "$region"
echo "📒 Updating bounds and sea..."
update_bounds
echo "✂️ Building tiles: $region"
update_tiles "$region"
fi
else
echo "⚠️ Region \"$region\" does not exist"
fi
done
echo "📒 Updating bounds..."
update_bounds
for region in $regions_array; do
if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then
echo "🔨 Building Garmin map: $region"
build_gmap "$region" "$style"
else
[[ $? != 0 ]] && die "Region \"$region\" does not exist"
fi
else
echo "⚠️ Region \"$region\" does not exist"
fi
done
echo "🧹 Cleaning up..."
cleanup

View File

@ -10,15 +10,7 @@ do
[[ -n "$OSMGARMIN_REGIONS" ]] && regions="$OSMGARMIN_REGIONS"
[[ -n "$OSMGARMIN_STYLE" ]] && style="$OSMGARMIN_STYLE"
regions_array="$(echo $regions | tr ";" "\n")"
for region in $regions_array; do
if [[ "$(check_osm_update "$region")" == "true" ]]; then
/app/build-gmap.sh "$region" "$style"
# TODO: Tear this apart so we can update the maps and bounds separately,
# then build all the maps afterwards (less wasteful!)
fi
done
/app/build-gmap.sh "$regions" "$style"
sleep 3600
done