Skip to content

Map around current position - Connect IQ - DataField

Notifications You must be signed in to change notification settings

tskf/MapOfflineGPS

Repository files navigation

Map Offline (GPS)

Shows map image around current position. Aimed to give navigation ability for watches without maps and courses.

  • As memory is limited, best to use 2 colors image.
  • For 2 colors and 16 KB memory - max size is: 2000 x 2000 px.
  • As an example, shows world map (based on STyx's map).
  • Refreshes only when is visible (auto call onUpdate() function), to reduce calculations.
  • Shows static image, no zoom.

logo

Usage

  • Copy compiled Map.prg to the APPS\ directory.
  • Select: Activity SettingsData ScreensScreen #Field #Connect IQMap.

Compile

Prepare map.png

  • Image should be black-and-white, 2000 x 2000 px.
  • Look for printable/simple/bw/outline maps online, or use map viewer with editable style, or decrease color depth in graphic program.
  • Suggestion: you can mark on map some paths and points.

Download

  • ImageMagick zip. You can use portable-Q16 version, x86 or x64 as your system.
  • OpenSSL zip: curl.se (Specifications32bit or 64) or bintray.com (version → Fileswin32 or 64).
  • Dev-kit. Current version requires SDK Manager (login required) to download kit and selected devices.

archive.org

  • ImageMagick: 7.0.11-0 → portable-Q16-x: 86 | 64
  • OpenSSL: curl.se 1.1.1i32 | 64 or bintray.com 1.1.1h32 | 64
  • Dev-kit: 3.1.9zip - was the last version with Direct Download (contains kit and all devices).

Paths

  • Add paths to dirs where unpacked.
  • At the end of Path variable, separate by semi-colon ;
    • sysdm.cplAdvancedEnvironment Variables...System variablesPath
    • Example: C:\ImageMagick\;C:\openssl\;C:\ciq\bin\
    • Then you can use short: convert, openssl, monkeyc
  • Or add before each command: C:\ciq\bin\monkeyc
  • If using SDK Manager, then path is:
    • %AppData%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-VERSION\bin\

resources\m

  • You can use bat scripts from temp dir map\.
  • ImageMagick:
    • index-colors.bat - simply decrease color depth: convert map-color.png -threshold 70% map.png
    • crop.bat - crop prepared map (create m dir first): convert map.png -crop 250x250 m\%01d.png
  • Check if map is correctly cropped and copy it to: resources\m dir.
  • 2000 x 2000 px cropped to 250 x 250 gives 64 parts (from 0.png to 63.png).

map.mc

  • Check where your map starts (left upper corner) and ends (right down corner).
  • And enter those coordinates here (latitude and longitude).
const ut=83.64, un=-180.0,  // left upper corner
      dt=-66.20, dn=180.0,  // right down corner

dev_key.der

  • Generate key using OpenSSL - gen_key.bat:
openssl genrsa -out dev_key.pem 4096
openssl pkcs8 -topk8 -inform PEM -outform DER -in dev_key.pem -out dev_key.der -nocrypt

Map.prg

  • Replace DEVICE by your device id (check manifest.xml or bin\devices.xml at kit) - compile-release.bat:
monkeyc -y dev_key.der -f MapOfflineGPS\monkey.jungle -r -o Map.prg -d DEVICE

About

Map around current position - Connect IQ - DataField

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages