I think it’s better to keep the conversation understandable for everyone.
(German version below
)
So, I found an expression that projects a given point onto the closest line of a specified layer and then prints out how far along that line our point is located.
As far as I know, there is currently no out-of-the-box way to run expressions outside of a feature context. Meaning you would have to create a point every time you want the information.
The expression may need some adjustments for larger datasets, since it currently checks the distance against all lines in the given layer, which could be memory-intensive and result in longer processing times.
A QField plugin could allow you to run said expression in intervals (e.g., every 5 seconds) and overlay the information on your screen in real time, without having to touch underlying data structures.
If you’d like to explore a tailored solution or plugin development, feel free to get in touch. I’m happy to discuss options.
with_variable(
'current', $geometry,
with_variable(
'line_layer', '<line layer name>',
with_variable(
'line',
line_merge(
array_first(
aggregate(
@line_layer,
'array_agg',
$geometry,
order_by := distance($geometry, @current)
)
)
),
if(
is_empty_or_null(@line),
NULL,
line_locate_point(@line, closest_point(@line, @current))
)
)
)
)
Also, ich hab’ eine Expression gefunden, die einen Punkt auf die nächste Linie eines vorbestimmten Layers projiziert und ausgibt, wie weit entlang der Linie der Punkt liegt.
Soweit ich weiß, kann man Expressions out-of-the-box momentan nur im Kontext von Features ausführen. Bedeutet also, du müsstest jedes Mal einen Punkt anlegen, wenn du die Informationen haben möchtest.
Für größere Datasets müsste man die Expression nochmal ggf. etwas anpassen, da sie momentan den Abstand zu allen Linien im angegebenen Layer überprüft. Das kann speicherintensiv sein und zu längeren Verarbeitungszeiten führen.
Ein QField-Plugin könnte dir ermöglichen, die Expression in bestimmten Intervallen (z.B. alle 5 Sekunden) auszuführen und die Informationen in Echtzeit bspw. neben deinem Positionierungsmarker anzuzeigen, ohne dass man bestehende Datenstrukturen anpassen müsste.
Falls du so eine maßgeschneiderte Lösung oder ein Plugin brauchst, melde dich gerne direkt bei uns (per DM oder gerne auch telefonisch), dann können wir Genaueres besprechen.