summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2022-05-03 07:06:20 +0400
committerSuren A. Chilingaryan <csa@suren.me>2022-05-03 07:06:20 +0400
commit90d1bf5893a9a373eccd40693f801aa74c3ad36b (patch)
tree3a6574b7299fcffdb5d52d47d59ec3d3832486d6
parent682b308d8a7804d0ae2b2606b3ba0ff8814c1473 (diff)
downloadopenmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.gz
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.bz2
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.xz
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.zip
Regularly update cookie jar; update map paths; include gpx scripts
-rw-r--r--.gitignore10
-rw-r--r--README.txt28
-rwxr-xr-xdownload.sh61
-rwxr-xr-xgenerate.sh5
-rw-r--r--lists/caucasus.txt3
-rw-r--r--tracks/README46
-rw-r--r--tracks/rename.sh15
7 files changed, 135 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index 90a9e7d..541f8d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
-downloads
-maps
-current-*.txt
-cookies.jar
.pass
+cookies.jar
+current-mtb.txt
+current-velo.txt
+downloads/*
+maps/*
+tracks/GPX
diff --git a/README.txt b/README.txt
index cd99abb..d54cc31 100644
--- a/README.txt
+++ b/README.txt
@@ -5,7 +5,6 @@ Problems
all Unicode maps to be signed. Non-Unicode maps (from openmtbmap project) work
well
-
Note
====
(Of course you could also define the .img files by folder, and you probably
@@ -17,18 +16,19 @@ Note that all 6*.img have to be from the same openmtbmap country file -
otherwise only one "country" will show in proper colours. You can instead of
deleting all but one typfile replace *.TYP with e.g. clas*.TYP or the full
name like clasde.TYP.
+ * family-id should be the same number as the first 4 digits of the maps (if
+ you use a different number, you have to adjust the FID inside the .TYP-file).
+ Note every map on your gps needs a different family-id (else they won't be shown).
+ * family-name can be set to any value (only use letters and numbers, no
+ Umlauts or symbols) and will be shown as mapname on the GPS maplist.
--–family-id should be the same number as the first 4 digits of the maps (if
-- you use a different number, you have to adjust the FID inside the
-- .TYP-file). Note every map on your gps needs a different family-id (else
-- they won't be shown).
-
--–family-name can be set to any value (only use letters and numbers, no
-- Umlauts or symbols) and will be shown as mapname on the GPS maplist.
-
-2 b) if you want to have contourlines (altitude lines) included too, just
-change the above command from "6*.img" to "6*.img 7*.img" and put the *.img
-from the contourline download into the same folder before running the above
-command.
-
+Countours
+=========
+- By default, this software will generate maps without countour-lines.
+ * DEM-maps can be generated separately (and only once), e.g. using
+ map-source and uploaded a separate .img file. Seems work without problems.
+ * If you want to have contourlines (altitude lines) included in the map, just
+ change the above command from "6*.img" to "6*.img 7*.img" and put the *.img
+ from the contourline download into the same folder before running the above
+ command.
\ No newline at end of file
diff --git a/download.sh b/download.sh
index 2631ec7..d3ac068 100755
--- a/download.sh
+++ b/download.sh
@@ -17,18 +17,40 @@ fi
if [[ "$list" =~ "velo" ]]; then
url_nonu="http://openmtbmap.org/?s2member_file_download=odbl/nonunicode/english"
+ url_u="http://openmtbmap.org/?s2member_file_download=odbl/english"
url="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl/velomap"
else
url_nonu="http://openmtbmap.org/?s2member_file_download=odbl/nonunicode/english"
+ url_u="http://openmtbmap.org/?s2member_file_download=odbl/english"
url="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl"
fi
+if [ -f "cookies.jar" ]; then
+ if test `find "cookies.jar" -mmin +120`; then
+ do_auth=1
+ else
+ do_auth=0
+ fi
+else
+ do_auth=1
+fi
-if [ ! -f "cookies.jar" ]; then
+if [ $do_auth -ne 0 ]; then
curl -d log="csa7fff" -d pwd="$(cat .pass)" -d rememberme="forever" --cookie-jar ./cookies.jar https://openmtbmap.org/wp-login.php &> /dev/null
[ $? -ne 0 ] && { echo "Login failed"; exit 1; }
+else
+ echo "Re-using old authentication cookies"
fi
+function check {
+ local fail=$1
+ local name="$2"
+
+ [ $fail -ne 0 ] && return $fail
+ size=$(du -sm "downloads/$name" | awk '{ print $1 }')
+ [ $size -lt 2 ] && return 1
+ return 0
+}
mkdir -p downloads
for name in $(cat $list); do
@@ -37,27 +59,42 @@ for name in $(cat $list); do
# Try first non-unicode
fail=0
curl -L --cookie cookies.jar "$url_nonu/$name" -o "downloads/$name" &> /dev/null
- if [ $? -ne 0 ]; then
- fail=1
- else
- size=$(du -sm "downloads/$name" | awk '{ print $1 }')
- [ $size -lt 2 ] && fail=1
+ check "$?" "$name"
+ fail=$?
+
+ if [ $fail -ne 0 ]; then
+ echo curl -L --cookie cookies.jar "$url_u/$name" -o "downloads/$name" #&> /dev/null
+ check "$?" "$name"
+ fail=$?
+ fail_nonu=1
fi
if [ $fail -ne 0 ]; then
+ exit 1;
rm -f downloads/$name
fail=0
curl -o downloads/$name $url/$name &> /dev/null
+ check "$?" "$name"
+
+ if [ $? -ne 0 ]; then
+ curl -o downloads/$name $url/asia/$name &> /dev/null
+ check "$?" "$name"
+ fi
+ if [ $? -ne 0 ]; then
+ curl -o downloads/$name $url/africa/$name &> /dev/null
+ check "$?" "$name"
+ fi
+
if [ $? -ne 0 ]; then
fail=1
- else
- size=$(du -sm "downloads/$name" | awk '{ print $1 }')
- [ $size -lt 2 ] && fail=1
fi
+
[ $fail -ne 0 ] && echo "*** Failed ***: $name"
- [ $fail -eq 0 ] && echo "Unicode version: $name"
- else
- echo "Non-unicode version downloaded: $name"
+ [ $fail -eq 0 ] && echo "Unicode version (local language!): $name"
+ elif [ -n "$fail_nonu" ]; then
+ echo "Non-unicode english version downloaded: $name"
+ else
+ echo "Unicode english version downloaded: $name"
fi
done
diff --git a/generate.sh b/generate.sh
index 721e09d..ae4fdad 100755
--- a/generate.sh
+++ b/generate.sh
@@ -28,7 +28,6 @@ if [[ "$file" =~ "velo" ]]; then
name=`basename $file .exe | cut -c 5-`
img=maps/velo-$name.img
else
- typ=thin*.TYP
name=`basename $file .exe | cut -c 4-`
img=maps/mtb-$name.img
fi
@@ -41,8 +40,8 @@ fi
prepare $file
if [ ! -f work/$typ ]; then
- echo "Type file is not found, failing out..."
- exit 1
+ [ -f work/clas*.TYP ] && typ=clas*.TYP
+ [ -z "$typ" ] && { echo "TYP file is not found (might be naming changed again, check in workdir), failing out..."; exit 1; }
fi
id=`ls work/6*.img | head -n 1 | cut -c 6-9`
diff --git a/lists/caucasus.txt b/lists/caucasus.txt
new file mode 100644
index 0000000..bc6cc24
--- /dev/null
+++ b/lists/caucasus.txt
@@ -0,0 +1,3 @@
+mtbarmenia.exe
+mtbgeorgia.exe
+mtbiran.exe
diff --git a/tracks/README b/tracks/README
new file mode 100644
index 0000000..31cf41c
--- /dev/null
+++ b/tracks/README
@@ -0,0 +1,46 @@
+Firmware
+========
+ - Firmware will be updated automatically if device is connected to WiFi network. This doesn't work on the power cable
+ and batteries should be present in the system. Once firmware downloaded (on WiFi availability, no message), the update
+ will be performed during next restart.
+
+Sync
+====
+ - There is multiple sources of tracks, routes, and waypoints.
+ * Garmin/GPX folder (in earlier firmwares this was limited to tracks in GPX/Archive in the main memory
+ The data will be not loaded from SD and waypoints/routes were not supported. This is not fixed by using MapSource
+ or old version of BaseCamp. But this seems fixed in the current firmware).
+ * EDM database which updated when routes/waypoints are stored on device or synchronized using explore.garming.com
+
+ - Easiest way to synchronize.
+ * Generate a list of .gpx files using basecamp: separate file for each track and route, but one for waypoints.
+ Names are non-informative and will be as bad in the device if copied as is. Rename script will fix it and organize
+ structure.
+ * Basically puts all tracks to 'GPX/Archive' folder which will ensure they are not using active memory. Waypoints
+ and routes go to directly under 'GPX'. Waypoints/routes goes to SD. Tracks for now should be stored in main memory
+ as on SD they are not archived but active even if put under 'GPX/Archive'. In the internal memory, it OK.
+ * Routes will still not preserve the actual path and will be recalculated on the device (but there is no way around
+ with other synchronization options)
+
+ - osmand
+ * Single GPX is reasonably imported (and can be easily removed). However, routes are imported as small tracks (consisting
+ of waypoints only). There is no way to pass the routing either. So, basically best to exclude routes.
+
+
+ - Problems
+ * If archived, there would be no way to sort/filter tracks (they are even not alphabetically sorted). So, it is
+ quite inconvinient for overview. Might be better solution is to use osmand for planning and Garmin on the trail and
+ for routes.
+
+
+Garmin Explore
+==============
+ - Routes need to be loaded one by one or the naming will be lost if a single GPX with multiple routes is used. Using
+ kml input doesn't help either.
+ * Routes also include waypoints and importing routes and waypoints sequentially will result in dublicates (also on
+ the device).
+ - Tracks are not possible import at all. Web site just says 'Invalid media type'. Even if a single track is imported.
+ KML import results in the same error.
+ - Tracks/routes from 'GPX/' on the device are synchronized (but not tracks in the 'GPX/Archived'). So, thats probably
+ the only way to import stuff in the system.
+ - The web site is also anyway pretty limited in the sense of route analysis (no routing!), etc.
diff --git a/tracks/rename.sh b/tracks/rename.sh
new file mode 100644
index 0000000..e1504a9
--- /dev/null
+++ b/tracks/rename.sh
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+mkdir -p GPX/Archive
+
+for name in $(ls Route*.gpx Track*.gpx 2>/dev/null); do
+ new_name=$(cat "$name" | grep -oP "(?<=<name>).*?(?=</name>)" | head -n 1 | sed -e 's/[^0-9a-zA-Z]\+/_/g').gpx
+ if [[ "$name" =~ ^Route ]]; then
+ new_name="GPX/$new_name"
+ else
+ new_name="GPX/Archive/$new_name"
+ fi
+ echo "Renaming: $name to $new_name"
+ mv "$name" "$new_name"
+done
+[ -f Waypoints.gpx ] && mv Waypoints.gpx GPX/