0

Can I use QGIS 3.10 to display overlaid encoded google polylines, with the purpose of showing road network activity?

I am using QGIS 3.10.

I have a series of GPS points that go from one origin to ten different destinations, with average journey length 1,000km. The points were uploaded by CSV file and are sorted by journey, then by the appropriate consecutive next location i.e. everything is sequential. The points are derived from an encoded Google overview polyline that has been decoded.

The road network is a separate layer.

The first image shows all journeys' GPS points along a short section of one of the roads (yellow spots, along the yellow road). GPS points along road section

I used the "points to path" tool to make the purple lines, where the paths are created on a per-journey basis and in the correct sequential order. Some sections of the created paths do not align with the road network, despite individual points being accurate. Road, points and lines

The section of road in the screenshot is approximately 35km long, and the max variation between the "point to path" line and the road is 1,750m. This is one of many examples where the variation is significant. I understand QGIS has just drawn from, say, [journey 2; point 21] to [journey 2; point 22] when making the line, and that it has not dropped extra points in between to ensure snapping to the road.

I would like the purple lines (created by "points to path") to follow the road network when they connect the yellow spots. This is because I would like to make a heatmap of road network use. The plan was to follow instructions in Doing heatmap from line data in QGIS? to use QChainage to break the paths back into regularly-spaced points.

Currently, when I plot a heatmap of the individual GPS locations used, I get erroneous gaps. The origin for each journey shown is at the left-hand side of the image, and no destinations exist within the picture. That is, this road has been used a uniform number of times, so the heatmap should be one uniform colour. Heatmap

The heatmap shows what it does because of the random number of GPS locations at random intervals along the same road, I understand that.

How do I make it so that if I plotted a path linking the individual journey points in their respective consecutive order, that path would snap to the road network?

The purpose being I would like to then break the paths back to points, to make a heatmap (unless there is a better way to show something similar with overlaid lines/paths).

Can I make the "point to path" lines snap to the road network?

Or, to put it another way, how do I make the "point to path" lines follow the road when they are created?

The lines are clearly made point-to-point as fits the particular journey, I have no issue with that, but I would like the created paths to snap to the roads and I can't figure out how to do it.

I acknowledge the network analysis "shortest path" tool could help here, but it is incredibly slow on my computer, and the underlying data is already the result of a "shortest path" analysis. Once I work out how to plot the data in this little dataset I will be plotting thousands more journeys.

I am happy to learn Python if it makes this problem go away.

14
  • You did not tell us if you have a separate layer for the roads or not. Also, you don't provide sample data or a screenshot of how your data (attributes) look like: do you have some attributes included that makes it possible to identify which point belongs to which journey? This information is critical to be able to help you.
    – Babel
    Commented Jun 2, 2021 at 5:21
  • If you have a road network you want to use, than you could use network analysis tool, shortest path and set start- and end-point of your gpx-journeys as input. If the gxp-teack follows the shortest possible way in the network, you get what you want.
    – Babel
    Commented Jun 2, 2021 at 5:25
  • Imagine QGIS putting extra points between 2:21 and 2:22 - that would create a totally weird line. Before calling for a "fix" of the data, have you verified that the other data, the lines, are actually correct? Or maybe they are generalized and your points actually are the correct ones (yeah, unlikely, since GPS, esp. in mountaineous areas, tends to be jumpy).
    – Erik
    Commented Jun 2, 2021 at 6:37
  • how have you ordered the points in the points to path tool?
    – JGH
    Commented Jun 2, 2021 at 10:05
  • What happens when you use the Points to Paths (note the plural Paths) plugin, with the Line per Vertex option checked on?
    – Stu Smith
    Commented Jun 2, 2021 at 13:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.