Falcosc / locus-addon-tasker

Locus Maps API useable as Tasker Plugin
GNU General Public License v3.0
9 stars 2 forks source link

Navigate to nearest point in track #27

Open algil opened 2 years ago

algil commented 2 years ago

Hi, Currently the Locus API and Locus/Tasker plugin provide Action Tasks "Navigation/Recalculate" (current track) and "Navigate To" (a new target point). However more useful for me would be "Navigate/Nearest point" (current track). When navigating a track if I decide to shortcut/bypass part of the track then Locus continues to target the section of the track bypassed - I think it will not jump ahead more than 100 track points, so need then to use the "Navigate/Nearest point" action.

Is there any way to get this added ? If I raise an Idea in Locus myself I'm doubtful there would ever be enough API users to get enough votes. Thanks Alan

Falcosc commented 2 years ago

It is very expensive to find the nearest point of a large point list if the nearest point could be located in every direction around your local position.

You would need to limit this search operation to a small number of points.

I guess you don't want to use the "next Navigation Point"? The only smart way of reducing the time to wait for finding the next point would be a configurable limit of points after and before the next navigation point.

For geotagging it was a bit less difficult because finding the nearest timestamp was a one dimensional task and binary search was great for that: https://github.com/Falcosc/locus-addon-tasker/blob/1433b019b256a911283e22ea6be752e3877e4625/app/src/main/java/falcosc/locus/addon/tasker/GeotagPhotosService.java#L312 With 2 dimensions, I don't know, you can't even sort the points because of having 2 dimensions. This would be a great question for someone, how did study such kind problems.

algil commented 2 years ago

Hi I am not suggesting to calculate the nearest point in the Locus/tasker plugin. I only want to be able to instruct Locus to execute the "Nearest point" action in a similar way as is available for "Recalculate". "Nearest Point" action causes Locus to set the target point on the track as the nearest track point to the current location.

So, when navigating a track in Locus tapping on the navigation arrow allows to then choose "Nearest point" or "Recalculate". The Locus/tasker plugin allows to automate "Recalculate" by executing Action Task "Navigation/Recalculate". I would like there to be also an Action Task in the Locus/tasker plugin for "Navigation/Nearest point" to automate this also.
As far as I can see, the Locus API doesn't support this so it would need a change in the Locus API as well as the plugin.

Currently I'm forced as a workaround to use the Tasker/AutoInput plugin to press the buttons in Locus but its not ideal.

Falcosc commented 2 years ago

Jumping forward is more easy, but you are right, there is no way to tell locus to execute the existing action. But maybe it is easy to integrate in the action tasks because it is an existing function.

algil commented 2 years ago

Yes, I'm hoping the Locus team could add it without much effort. Not sure how to take that forward - if I raise as an Idea it probably wouldn't get many votes. Or should I raise it on the forum first ?