Locus Map - forum

Support => Troubles & Questions => Topic started by: Testi on February 09, 2014, 12:22:05

Title: "You veered off the course" warning ?
Post by: Testi on February 09, 2014, 12:22:05
Hello,

sometimes I import a course from Google Earth or similar and then follow it, like when I hike. Every now and then, I veer off the course while not looking, and then when I next check Locus like 20 minutes later and see I got lost, I have to go all the way back. Is there a way to make Locus ring a warning or whatever if you are more than x feet from a path or something like that ? Or what is the best way to follow a predetermined path without constantly looking at the map ?
Title: Re: "You veered off the course" warning ?
Post by: Menion on February 09, 2014, 12:35:56
Hi,
  are you using "Guiding" feature, or you just display track on map and from time to time you check by eyes this track?

  Unfortunately we don't have yet manual on this tasks, but at least basic here - http://support.locusmap.eu/hc/en-us/articles/200197661
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 09, 2014, 12:38:04
I tried using the Guiding feature once, but it kept trying to guide me to the start of my track, no matter what I did, it wouldn't understand that I wanted to go forward.
Title: Re: "You veered off the course" warning ?
Post by: Henk van der Spek on February 11, 2014, 09:36:19
Over the last couple of years I did more than 800 km of guiding on gpx tracks with Locus. Excellent feature.

When you saw:  "... it kept trying to guide me to the start of my track.." did you activate guiding after tapping on the track label that is visible when you hover over the track?

I usually select the track in Data/tracks/ with a short tap and then in the popup menu, I select "guiding".

In the guiding settings also select "Automatically select best/next point".

And set the audible notifications. First select on and then tap on the text left from the button. Then you get a menu to set :  distance, repeat and signal.
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 11, 2014, 12:19:12
I will play around with that the next time I go for a hike. Those tracks you use, are they just 'corner points', like what you get from Google Earth, where for long straight parts there is no points in between ?
Title: Re: "You veered off the course" warning ?
Post by: Henk van der Spek on February 11, 2014, 12:26:43
Nono, tracks with more points like the attached one from the internet (and we did walk this one).

How many points offcourse depends on the settings that the "recording person and tool" used.

You can also do a recording yourself in Locus and then try it out for guiding.
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 12, 2014, 20:43:48
I tried it again today with the low point course I had and I got a single beep when I veered off course, and nothing after that. Also no way to configure that behaviour. If I somehow missed that beep, it could have taken forever for me to notice I wasn't on course anymore :(
Title: Re: "You veered off the course" warning ?
Post by: Menion on February 12, 2014, 20:49:45
did you check settings for Guiding?

settings > guiding: http://support.locusmap.eu/hc/en-us/articles/200003082

settings > guiding > notification: http://support.locusmap.eu/hc/en-us/articles/200118982
Title: Re: "You veered off the course" warning ?
Post by: Henk van der Spek on February 12, 2014, 21:07:35
Ah, the "boss"is faster. In screenshot one tap in the red circle, yes in the textlines (was a surprise discovery for me too some time ago) and then you get screen2 where you must activate repeat and set the repeat value (in seconds).Then, turn up the volume, put your phone in your pocket and '''walk ... walk ...

(http://s16.postimg.org/i7qjy74dd/1_Screenshot_2014_02_12_20_53_33.jpg) (http://postimg.org/image/i7qjy74dd/)  (http://s16.postimg.org/ywrzu40yp/2_Screenshot_2014_02_12_20_53_53.jpg) (http://postimg.org/image/ywrzu40yp/)
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 13, 2014, 00:04:59
Very cleverly hidden! Thank you, that looks exactly like what I was hoping for! I would have never found that on my own lol. I will report back after trying it. What will happen if I set it to beep at 250m, and I am between 2 points that are 1000m apart ? Will it understand that I'm still close to the 'line' ?
Title: Re: "You veered off the course" warning ?
Post by: Menion on February 13, 2014, 06:48:41
It's really so hidden? But Android in it's settings use same mechanism for Wi-fi, Bluetooth and some other ... damn
Title: Re: "You veered off the course" warning ?
Post by: Christian on February 13, 2014, 07:30:09
Yes its hidden. Never expected a enhanced menu when i slider is shown. Even in WLan settings :(
May be a small triangle beside the capture of the slider can help...
Title: Re: "You veered off the course" warning ?
Post by: gynta on February 13, 2014, 07:44:27
It's really so hidden?
no
Quote
But Android in it's settings use same mechanism for Wi-fi, Bluetooth and some other ...
like you said...
Title: Re: "You veered off the course" warning ?
Post by: KaHeMu on February 13, 2014, 08:48:13
Yes its hidden. Never expected a enhanced menu when i slider is shown. Even in WLan settings :(
May be a small triangle beside the capture of the slider can help...

+1
Title: Re: "You veered off the course" warning ?
Post by: Henk van der Spek on February 13, 2014, 11:21:22
Very cleverly hidden! Thank you, that looks exactly like what I was hoping for! I would have never found that on my own lol. I will report back after trying it. What will happen if I set it to beep at 250m, and I am between 2 points that are 1000m apart ? Will it understand that I'm still close to the 'line' ?
Then it will beep like crazy! Proper tracks have the points at 50 to 100 meter distance. About 400 points for a days walk.

And yes , it is a "bit" hidden. I think it was Gynta who helped me find it about half a year ago. Well, that's what the forum is for.
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 14, 2014, 18:55:49
Geez, I didn't mean to imply any fault on Locus' part or to start a fight!

My tracks don't have many points because it's planned routes I click together in Google Earth, but I'm sure I can find a way to make it generate intermediate points. Lots of sun in the forecast for Sunday, so I'll find out then!
Title: Re: "You veered off the course" warning ?
Post by: Menion on February 15, 2014, 14:01:41
Don't worry, fights do not exists on Locus forum ;)

To plan track, I may suggest to use Add new route & measure (http://support.locusmap.eu/hc/en-us/articles/200033951-Add-new-route-Measure) function. It offer quite useful tool under button 5. Just keep in mind, that this function require internet connection
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 15, 2014, 14:42:18
I have a powerful desktop computer and a gigantic monitor, so at home I tend to not use my phone for anything, but I will try a few different ways to do it tomorrow.
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 16, 2014, 01:09:07
Here are my results from some experimenting:

I can't use the navigation function, because I plan hiking trips on dirt trails and such that are not navigable, and even if they were, I just want to pick routes on the maps, not generate routes. When drawing with Locus, it also doesn't make intermediate points on its own.

So I wrote a short little Java program to take a .KML file and just add points in the middle of long lines. Maybe someone else might want something like that, so here goes:

Code: [Select]
package com.boringville.misc.pointadder;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

import lombok.RequiredArgsConstructor;
import de.micromata.opengis.kml.v_2_2_0.Coordinate;
import de.micromata.opengis.kml.v_2_2_0.Document;
import de.micromata.opengis.kml.v_2_2_0.Feature;
import de.micromata.opengis.kml.v_2_2_0.Kml;
import de.micromata.opengis.kml.v_2_2_0.LineString;
import de.micromata.opengis.kml.v_2_2_0.Placemark;

public class PointAdder {
    @RequiredArgsConstructor
    private static class Distance {
        private final Coordinate first, last;

        /** Basically copied from http://stackoverflow.com/questions/837872 */
        public double calculate() {
            double dLat = Math.toRadians(last.getLatitude() - first.getLatitude());
            double dLng = Math.toRadians(last.getLongitude() - first.getLongitude());
            double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
                    + Math.cos(Math.toRadians(first.getLatitude()))
                    * Math.cos(Math.toRadians(last.getLatitude())) * Math.sin(dLng / 2)
                    * Math.sin(dLng / 2);
            double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            return c;
        }
    }

    public static void main(String[] args) {
        double earthRadius = 6369628.75D;
        double maxDistance = Double.parseDouble(args[0]) / earthRadius;
        Kml kml = Kml.unmarshal(new File(args[1]));
        Document document = (Document) kml.getFeature();
        for (Feature feature : document.getFeature()) {
            if (!(feature instanceof Placemark)) {
                continue;
            }
            Placemark placemark = (Placemark) feature;
            LineString ls = (LineString) placemark.getGeometry();
            List<Coordinate> inCoords = ls.getCoordinates();
            List<Coordinate> outCoords = new ArrayList<Coordinate>();
            Coordinate lastPoint = null;
            for (Coordinate coordinate : inCoords) {
                if (lastPoint != null) {
                    double distance = new Distance(lastPoint, coordinate).calculate();

                    if (distance > maxDistance) {
                        double steps = Math.ceil(distance / maxDistance);
                        double stepLong = (coordinate.getLongitude() - lastPoint.getLongitude())
                                / steps;
                        double stepLat = (coordinate.getLatitude() - lastPoint.getLatitude())
                                / steps;
                        for (int i = 0; i < steps; i++) {
                            outCoords.add(new Coordinate(lastPoint.getLongitude() + stepLong * i,
                                    lastPoint.getLatitude() + stepLat * i));
                        }
                    }
                }
                lastPoint = coordinate;
                outCoords.add(coordinate);
            }
            ls.setCoordinates(outCoords);
        }
        try {
            kml.marshal(new File(args[2]));
        } catch (final FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}

And here is the neccessary pom.xml if you want to build it without fiddling with class paths and libraries:

Code: [Select]
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.boringville.misc</groupId>
<artifactId>pointadder</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>pointadder</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>de.micromata.jak</groupId>
<artifactId>JavaAPIforKml</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.12.4</version>
</dependency>
</dependencies>
</project>

I don't really understand licenses but everyone is free to do whatever they want with the code as long as they don't try to hold me accountable for blowing up their computers ;)

Ooops almost forgot, you use it by doing "java PointAdder 50 in.kml out.kml" where in.kml is the Google Earth or whatever generated one and out.kml is the name of the resulting file. 50 is the maximum distance in meters that you want between two points.
Title: Re: "You veered off the course" warning ?
Post by: Testi on February 16, 2014, 12:28:57
Here you can see what it does, before:

(http://i.imgur.com/iTW5OEH.png)

As you can see, I only put a point at the start of Rotsiefweg and at the end, since it's very straight. But it's 500m long, so at my setting to beep if you get more than 100m from the track, it would beep in between.

Here's the 'after':

(http://i.imgur.com/PU1myOH.png)