[Therion] Get shortest route
Benedikt Hallinger
beni at hallinger.org
Mon Nov 29 12:01:28 CET 2021
Hi Thomas,
thank you for the snippet, I succesfully tried it :)
For my convinience, I wrote a small wrapper to ease the call:
- It references my fixed aven file
- It has parameters 1 and 2 reference the respective stations
------snip shortestPath.py------
#!/usr/bin/python
#
# Wrapperskript fuer survex.py um den kuerzesten Pfad zwischen zwei
Stations zu errechnen.
#
# Bsp: Eingang -> Brueckenhalle: $ ./shortestPath.py
Hirlatzhoehle.Zubringer.1.1.0 Hirlatzhoehle.Alter_Teil.2.1.55
import sys
filename = "../Hirlatzhoehle/Hirlatz.th.3d"
station_from = sys.argv[1]
station_to = sys.argv[2]
from survex import Survex3D
survey = Survex3D(filename)
length, p = survey.shortestpath(station_from, station_to)
upwards = sum(max(0, t.z - f.z) for (f, t) in zip(p[:-1], p[1:]))
downwards = sum(min(0, t.z - f.z) for (f, t) in zip(p[:-1], p[1:]))
print("Shortest route length:", length / 100, "m")
print("Cumulated height going upwards:", upwards / 100, "m")
print("Cumulated depth going downwards:", downwards / 100, "m")
------snip------
Example call (Entrance to the Fragezeichenbiwak):
$ ./shortestPath.py Hirlatzhoehle.Zubringer.1.1.0
Hirlatzhoehle.Donnerbach.70.1.19
('Shortest route length:', 6773.091436823018, 'm')
('Cumulated height going upwards:', 781, 'm')
('Cumulated depth going downwards:', -770, 'm')
Thank you!
(nonetheless it would be awesome to get some more feature rich
integrated function in therion and/or aven)
Am 2021-11-28 18:49, schrieb Thomas Holder:
> Hi Benedikt and Olly,
>
> I implemented such functionality (not the visualization) a while ago
> as a little exercise in Python. If you know how to run a Python
> script, then you might find this useful.
>
> First download this file:
> https://raw.githubusercontent.com/speleo3/inkscape-speleo/master/extensions/survex.py
>
> Then run this code (replace the file name and station names):
>
> filename = "smk-arge.3d"
> station_from = "p87"
> station_to = "115.commando.105"
>
> from survex import Survex3D
> survey = Survex3D(filename)
> length, p = survey.shortestpath(station_from, station_to)
> upwards = sum(max(0, t.z - f.z) for (f, t) in zip(p[:-1], p[1:]))
> downwards = sum(min(0, t.z - f.z) for (f, t) in zip(p[:-1], p[1:]))
> print("Shortest route length:", length / 100, "m")
> print("Cumulated height going upwards:", upwards / 100, "m")
> print("Cumulated depth going downwards:", downwards / 100, "m")
>
>
> Cheers,
> Thomas
>
> On Sat, Nov 27, 2021 at 8:25 PM Olly Betts <olly at survex.com> wrote:
>>
>> On Fri, Nov 26, 2021 at 05:10:18PM +0100, Benedikt Hallinger wrote:
>> > i would want to get some advanced statistics regarding lengths in a very big cave (130km/Hirlatz).
>> >
>> > Basicly i want to supply two stations and get the following data for the shortest path:
>> > - length of shots
>> > - cumulated height for shots going upwards
>> > - cumulative depth for shots going downwards
>> > - optionally it would be cool to be able to somehow visualize the route in aven/loch, or in a therion map output
>> >
>> > Is this possible already?
>>
>> I don't think so.
>>
>> Someone was working on it, but I guess it didn't come to anything as
>> that was 2016:
>>
>> https://lists.survex.com/pipermail/survex/2016-October/002082.html
>>
>> Cheers,
>> Olly
>> _______________________________________________
>> Therion mailing list
>> Therion at speleo.sk
>> https://mailman.speleo.sk/listinfo/therion
More information about the Therion
mailing list