QFIELD: Plugin for Station and Distance along by Line from actually Position (GNSS)

Hello Community,

I would need a plugin for stationing along a specific line (road axis - the closest from my position) to also know distance to the line, but that is secondary. The lines are contained in a layer, there are always segments - e.g. Route 66 Section 130 and then I would need to know how far I am from the last node along the line/polyline

Unfortunately, I am not a programmer. Basic skills in C++ are available. I would have a similar solution in ArcGIS, with a mouse click, could this be used? or is this not strongly compatible…

Thanks for Answers

Hi and welcome!

I’m not entirely sure I fully understand your request. Would you mind sharing a quick sketch of what you’re looking for or a screenshot of your current solution in ArcGIS?

From my understanding, you want to find the closest point on a defined line or polyline to your current position, as well as some additional information, such as the distance to said line and its nearest vertices.

I think that sounds doable with a QField plugin!

If you don’t need it to be exact, what you can already do is hold your screen (right click on PC) and click “Set as Destination” to show the distance between you and where you held.

Hello Pascal,

Thank you for your quick reply. I’ve attached a sketch of the problem. It’s a road with a certain length, probably several kilometers. My position in this section is approximately 3.1 km in relation to the line stationing. You can’t see the beginning here. It’s a polyline, and it has several corners. However, I only need the length (station) from the beginning to my position. The layer with the lines (roads) has several thousand elements. I imagine that the nearest one is taken from my position and the length is determined immediately.

I’ve tried all the tools in QField, but apart from splitting the line by hand (quite cumbersome), I can’t get a good result because I can’t retrieve/read the length of the split line…

In QGIS there’s a plugin that delivers similar results, called KP-Find. Unfortunately, it only works with the first element in the layer. So, in QGIS, you have to select the line separately and save it as a layer with one line, and then click on the position with the mouse. Perhaps this is for editing, but as I said, I’m not sure how to do it.

I first have to find the app in ArcGIS, or rather, install this plugin; it’s not available in my version of ArcGIS right now.

Thank You for your Answer

PS: von deinem Profil abgeleitet - ich glaube wir könnten dieses Thema auch in Deutsch behandlen, ich weiss nicht, wie es hier so läuft :slight_smile:

I think it’s better to keep the conversation understandable for everyone.
(German version below :slightly_smiling_face:)

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.

hello pascal,

Thank you very much for your answer, I think the plug-in with display is good for QField, it should be usable outdoor. It can even be better done by clicking on the marker (or in its immediate vicinity). The values ​​could also remain on the screen and then have to be noted down or saved. if they always change, you can e.g. Don’t write it down later… it should just be simple. I’ll get in touch by phone or direct message.


hallo pascal,

vielen dank für deine Antwort, ich finde den Plug-in mit Anzeige schon gut für QField, es soll im Gelände verwendbar sein. Es kann sogar besser per klick auf den Marker (oder in seine unmittelbare Nähe) gehen. die Werte könnten auch am Bildschirm bleiben, müssen dann notiert werden oder gespeichert werden. wenn sie sich dann immer ändern, kann man sie z.b. später nicht mehr notieren… es soll einfach simple sein.
ich melde mich dann telefonisch oder per direktnachricht.