Optimizing Trail Recording

I coded a prototype how we could record fewer GPS positions in Mobile Trail Explorer and therefore save some memory but still have the same level of detail of the trail. Video might explain it best. Unoptimized recording is on the left and optimized trail is on the right.

The algorithm simply checks if the current direction have changed since last recorded position. If direction isn’t changed over the tolerance value then we can replace the last position with current position. Otherwise we only append the new position to the trail.

  1. public boolean canRemovePreviousPosition(
  2.         Vector<GpsPosition> positions,
  3.         GpsPosition pos1) {
  4.  
  5.     if(positions.size()<2) {
  6.         return false;
  7.     }
  8.  
  9.     GpsPosition pos2 = positions.elementAt(
  10.             positions.size()-2 );
  11.     GpsPosition pos3 = positions.elementAt(
  12.             positions.size()-1 );
  13.  
  14.     // Calculate last angle of trail
  15.     double latDelta = pos2.lat – pos3.lat;
  16.     double lonDelta = pos2.lon – pos3.lon;
  17.     double lastAngle = Math.atan(latDelta/lonDelta);
  18.  
  19.     // Calculate current angle
  20.     double latDelta2 = pos3.lat – pos1.lat;
  21.     double lonDelta2 = pos3.lon – pos1.lon;
  22.     double currentAngle =
  23.             Math.atan(latDelta2/lonDelta2);
  24.  
  25.     // Get absolute value of direction change
  26.     double angleDelta =
  27.             Math.abs(lastAngle – currentAngle);
  28.  
  29.     // Check the tolerance (0.105 radians = 6 degrees)
  30.     if(angleDelta>0.105) {
  31.         return false;
  32.     } else {
  33.         return true;
  34.     }
  35. }

Mobile Trail Explorer v1.14

It took a while to make this release. There was some kinky issues with the S40 devices which caused them to crash on NoMethodFoundException (Issue 145). Release notes for v1.14:

  • New logo and icon (Thanks Ash)
  • Improved MapCache initialization time
  • Fixed information screen scrolling
  • Splash screen hang fix (Issue 106)
  • WGS84 coordinates in degrees and minutes (Issue 162, Thanks Marco van Eck)
  • Fixed NullPointerException, NoMethodFoundException with S40 devices (Issue 145, 164)
  • NoSuchFieldError fixed (Issue 166)
  • Added decimal check to calculate time form (Issue 167)
  • Multiple formats for audio recording
  • …plus other minor fixes and features

Download binaries from here. Download source code from Google Code, here. Enter your issues here. Discuss about features and problems here.

OpenStreetMap Surveyor Feature

Mobile Trail Explorer v1.13 contains a new feature which is called OpenStreetMap Surveyor. With this feature all you OSM users can add common places to your OSM trails very easily. This is how you can active this feature:

  1. Choose “Keys” section from Settings menu
  2. Choose which key you want to configure, # or *
  3. Choose “Surveyor” action for selected key

Now you can activate the feature by clicking the selected key while you are recording your trail. When key is clicked you are shown a list of predefined placemarks from which you can select correct entry. This way it is quite easy to add bus stops etc. while you are walking, biking or driving around.

Surveyor Display

Surveyor Display

Trail Explorer v1.13

I was finally able to push the v1.13 release out of the door. There have been large amount of bug fixes that were annoying users in v1.12. There are also punch of excellent new features. Here’s the release notes for v1.13:

  • Option to prevent Map tiles from being downloaded over the network (Cached tiles will still be displayed)
  • Bug fix: When the locale is changed manually, it will be saved (From Kaspar)
  • Bug fix: LocaleManager does now respect the user-selected locale (From Kaspar)
  • Simplified the addition for additional locales (From Kaspar)
  • Find place by using Google service (From Kaspar)
  • German support tweaks (From Peter)
  • OpenStreetMap surveyor feature (From Vikas)
  • …plus tens of bug fixes and features

As always, you can download the binaries from here and source code from Google Code site, here.

You can (and you must) give some feedback on the Google Group: mobile-trail-explorer.

Have fun with GPS tracking! :)

Mobile Trail Explorer v1.12 Released

It’s only handful of days since last release, but I decided to release the v1.12 so soon as the v1.11 contained few bugs that were blocking few critical features, like adding a new waypoint and changing display settings.

You can download the new release from here or here. New version also contains a new languages, French and Dutch. You can now also change the language if you want to use other then phone default language. Thanks for the contributions and test reports reported on Google Groups discussions.