viking icon indicating copy to clipboard operation
viking copied to clipboard

Feature Request: Improved extensibility via external scripts

Open peterseverin opened this issue 1 year ago • 3 comments

Hi,

I am using Viking GPS extensively for track planning and I've created some custom scripts to help me with my workflow. To use these scripts I export a TrackWaipoint Layer to GPX, feed it into my script to produce another GPX and then re-import the GPX into Viking. I feel that this workflow could be improved if I could add a custom tool into Viking's context menus. The idea would be basically the same as for say Filter > Simplify All Tracks action which invokes GPSBabel witch an automatically exported GPX file and then re-imports the result back.

To make this even more flexible it would be nice to be able to invoke the tool on the entire Layer, or just a single Track or Route.

To give you a concrete example, I like the the Simplify All Tracks feature, but find it inflexible as it will apply the same number of points to all tracks/routes in the layer regardless of their length. So I have my own script that invokes GPSBabel on individual tracks/routes but the number of points for each track is calculated by the script using my own logic. Other useful scripts allow me to convert all tracks to routes in a GPX file, to combine tracks/routes using some naming convention etc.

To make this feature work there would be a need for a new xml configuration file where the user could name the context menu action, specify the command line command and and perhaps some other settings related to how the command should be invoked.

I feel that this feature would improve the extensibility of the Viking tool and allow users to adapt Viking better to their specific needs.

peterseverin avatar Jul 16 '23 15:07 peterseverin

Are you aware of the existing Edit-->Preferences-->Export/External External GPX Program 1 + 2 options?

Here you can specify any program (i.e. it could be your script - ensure it is on your $PATH or specify the full absolute filename). Then when you right click on a TrackWaypoint Layer, select External Tools-->Open with External Program: YourProgram

Admittedly this wouldn't open the results in same instance of Viking, but it could open the result in a new instance of Viking. (and then manually copy/paste it back into the main instance).

e.g. with another level of script indirection, here the '-' makes viking read from the stdin stream.

#! /bin/sh your_script | viking -

The existing Help guide is perhaps rather perfunctory on these options and could be expanded to demonstrate more interesting use cases.

Hopefully this is good enough for you needs.

Furthermore, one could possibly subvert the GPSBabel location option to point to your script instead. But of course this is not what that is really intended for. You probably would need to emulate some of the command line parameters of GPSBabel - as that is how Viking would be invoking the program.

rnorris avatar Jul 17 '23 11:07 rnorris

I guess this would partially work, although the last part where the GPX output is brought back into Viking is the most interesting and the most important part to me. Today I already can manually export the layer to GPX, feed it manually through a script and manually drag&drop the resulting GPX back into Viking. It would be nice to replace that with a single context menu entry, like those that we already have for gpsbabel.

peterseverin avatar Jul 17 '23 14:07 peterseverin

It would be great if Viking supported Python scripting. Just saying.

linuxguy123 avatar Aug 30 '23 18:08 linuxguy123