I have a huge dataset containing about zillion of points representing tracking locations of cars on the roads.

I also have roads datasets to compare to (from 3 different sources), to use for training machine learning models. Preferably using PyTorch or Tensorflow. Ideally re-using some existing model.

How to generate the road network, as automated as possible, using the point dataset representing tracking of these roads?

Note: The goal is NOT to snap points to existing roads, I know how to do that easily. The goal is to automatically generate reasonably good road network from points. Any research article or example related to automated network creation from points is welcome.

Example of points (red color at 10% opacity), and existing tracks over it (yellow dotted line):

Tracking location points vs existing mapped tracks

  • Maybe this can give some ideas? gis.stackexchange.com/a/382246/88814 (avoiding snapping)
    – Babel
    Commented Jun 22, 2021 at 12:43
  • 1
    Add an image to show what your data looks like, are these single tracks or stacks of points?
    – Hornbydd
    Commented Jun 22, 2021 at 14:00
  • Have a look at this answer: gis.stackexchange.com/a/387297/10661 It might be best to try and separate the points by input vehicle and then run the for each point set grouping.
    – Cushen
    Commented Jun 23, 2021 at 1:18

4 Answers 4


I would not recommend any basic point rasterization approaches if you want to generate a routable road network. You'll have to handle the car trajectories to learn the turning possibilities at intersections and to distinguish between real intersections vs. bridge or underpass situations.

There are lots of papers on this topic, e.g.

  • Cao, L., & Krumm, J. (2009, November). From GPS traces to a routable road map. In Proceedings of the 17th ACM SIGSPATIAL international conference on advances in geographic information systems (pp. 3-12).

but nothing has been integrated into GIS tools afaik.

  • Thank you, that helps a lot. I was certainly wrongly formulating my search phrase, extracting roads from gps traces is great tip.
    – Miro
    Commented Jun 28, 2021 at 1:34

If you have your data in postgis then you could use st_reduceprecision or st_snap_to_grid function and take only uniques geometries. This allows you to drastically minimize count of your points. In second step I would create vector grid. Size of grid cell should depend on distance between points you will regard as separate track. The bigger the cell the more generalized network. For points in every grid cell I would calculate st_geometric_median. After this you have only one point in grid cell, not necessarily in the center of cell which is good because you don't want to have 90 degrees angles in you network. The last step is to connect the dots to its nearest neighbours.

This was the vector solution. It maybe could be better to go raster solution if you have zylion points. First you have to make raster from your data. I would use gdal_rasterize. Then, on such raster, you could make dense contour lines (isolines) using gdal_contour and at the end choose one of isolines as your road. Maybe you could search in grass algorithms, there are tons of them, but I'm not familiar with it.

Your task is rather challenging thus there won't be simple answer.

  • Thank you. Yes, I guess there is no simple solution to this. I am just trying my luck to get answer from someone who tried something like this with machine learning to point me to something. As at this moment I really don't have much at all.
    – Miro
    Commented Jun 27, 2021 at 3:05

Not tried this, just thinking off the top of my head. How about using the point density tool in Arcmap, to create a raster, then threshold that, for example you decide a density of 10 points or greater is a road, everything else becomes no data. Then use the raster to polyline tool. Not sure how this would work when comparing highways with single tracks? You will probably want to use the Thin tool before the final conversion to a polyline dataset. The Thin tool tends to create spurs which need editing out and gaps closed. So a lot of work...

Changing the cell size of your density raster will influence what gets generated.

  • 1
    The same basic idea could be used in QGIS as well, creating a (vector) grid with squares, than using points in polygon and define a new attribute for the number of points in each grid cell.
    – Babel
    Commented Jun 23, 2021 at 6:56
  • Thank you. Yes, I am considering conversion to raster (or similar) as one of the options for semi-automed processing. Also in general from what I have seen so far existing machine learning models are working with rasters as inputs anyway. Both ESRI and QGIS work for me. Also looking at native solution in Postgis as that is how the data are saved currently.
    – Miro
    Commented Jun 23, 2021 at 13:07

Conceptually you could turn each string of points into a line and then merge adjacent lines. Points to Line could be used for the first step. Not sure technically how to accomplish the second step - maybe something along the lines of identifying similar lines as is discussed in this post?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.