3

I am trying to create an absolute center line layer from US interstate data that is multi-digitized (center line for each direction). I've looked at various options but they require a lot of processing involving voronoi polygons or adding points to lines and using a buffer or averaging those points. They work on very small data sets but anything larger slows down considerably to the point where it would be faster to do it by hand.

I'm currently trying to get v.centerline in GRASS to work but the documentation on it is very limited so I'm not sure if it will accomplish what I'm doing.

It seems that Esri has a tool that will do this. Is there an equivalent in QGis?

The roads don't maintain a perfect parallel so any simple solution tends to fail in those areas. Here's an example. enter image description here

brink
  • 820
  • 9
  • 23
  • It looks like GRASS's v.centerline does exactly what you want. I searched "centerline" in QGIS 3 plugins and saw that the HCMGIS plugin offers "Centerline for road/ river networks ". Worth checking out. – Jon Sep 28 '18 at 18:24
  • I thought so however I'm having a hell of a time getting it working. I can't install qgis 3 at the moment since I'm in the middle of a project and I have a lot of models built on 2.18 that won't transfer. https://gis.stackexchange.com/questions/297155/grass-7-4-addon-v-centerline-not-installing – brink Sep 28 '18 at 18:26
  • You can have more than one version of QGIS installed at a time. – csk Sep 28 '18 at 21:48
  • The plugin Digitizing tools has a tool called "digitize median line between adjacent polygons." So you would just need a way to turn your lines into polygons (perhaps with one-sided buffers). – csk Sep 28 '18 at 21:55
  • @csk any idea on how it works? All I can get it to do is draw a line from one node to another, sometimes... – brink Sep 28 '18 at 22:54
  • @Jon HCMGIS skeleton tool just stalls out. Looks like all he did was mash together the code of all the functions I tried before. It doesn't work on anything bigger then 3 feet of sidewalk. "the Skeleton/ Medial Axis function of HCMGIS used these core algs of QGIS: saveselectedfeatures -> polygonstolines -> pointsalonglines -> voronoipolygons -> polygonstolines -> explodelines -> selectbylocation -> saveselectedfeatures -> deleteduplicategeometries -> dissolve -> simplifygeometries" https://github.com/thangqd/HCMGIS/issues/3 – brink Sep 28 '18 at 23:34
  • Too bad. I've solved this problem in Python before (riverbanks) by parameterizing each polyline according to its along-stream (or road) distance. Then you can draw lines connecting opposite banks at the same downstream distances and take the midpoints of those lines as centerlines. I've also solved this problem by rasterizing and using skeletonization. Both methods require a bit more work than I've suggested here, though. – Jon Sep 28 '18 at 23:56
  • Your original drawing shows a map object that has a part of the object with the same width of the channels and a Central part with different width of the channel (the width of the channel can vary both in the big and in the smaller side), I meant it, i.e. parts of the object with different characteristics (width)... – Cyril Mikhalchenko Oct 04 '18 at 06:13

1 Answers1

1

I've come up with a simpler solution to using voronoi polygons. I'm not sure why nobody had tried this. I set up a processing modeler to run a few simple functions to get center points.

Buffer with dissolve on interstate - 200 meters enter image description here

Convert polygon vertices to points on buffer enter image description here

v.to.lines with delauney - draws lines from each vertices to another enter image description here

create negative buffer of original by 5 meters enter image description here

clip v.to.lines output with negative buffer to remove external lines - this leaves only lines crossing interstate. enter image description here

GDAL points to lines at .5 - puts a point halfway on each line crossing interstate which gives you center points.
enter image description here

Now you need a simple line to add values for points to paths since the point values in the layer can be random. You can use one side of the interstate layer if needed. Here's the instructions on how to do it. The reference line needs to be a single line. You may have to run the join multiple lines plug in if you are using the interstate layer.

Run points to paths and you have a nice center line. This method does not require a lot of processing power but you may be sacrificing a bit of accuracy. You will want to clean up some stray points on the ends before running points to paths.

enter image description here

brink
  • 820
  • 9
  • 23
  • In the example above, the centerline will not be accurate (correct), if the user is satisfied with this approximation, then this is also one of the ways to create the centerline – Cyril Mikhalchenko Oct 03 '18 at 15:35
  • @Cyril If you have a more accurate way of doing this that doesn't take a long time to process I'd like to know. I could never finish my project with the solutions that I found given the processing time. So far I'm working with about a 3-5 meter accuracy which is about as accurate at the interstate layer I'm using. – brink Oct 03 '18 at 16:07
  • If you're interested, check out this method https://gis.stackexchange.com/questions/290805/is-it-possible-to-convert-polygon-to-centerline-linestring/293294#293294 – Cyril Mikhalchenko Oct 03 '18 at 16:10
  • @Cyril I tried it. That method only works for uniform lines. Interstates don't stay parallel which throws off the point buffers. – brink Oct 03 '18 at 16:19
  • In your case, you need to divide the electronic map object (Interstate channels) into different types and process each type separately...however, automatically perform such an operation will be difficult... – Cyril Mikhalchenko Oct 03 '18 at 17:38
  • Now try out the points you got to create the centerline your way... – Cyril Mikhalchenko Oct 03 '18 at 17:47
  • I don't understand what you mean by "divide the electronic map object (Interstate channels) into different types and process each type separately". I need to do this for thousands of miles of interstate. – brink Oct 03 '18 at 17:51
  • Your original drawing shows a map object that has a part of the object with the same width of the channels and a Central part with different width of the channel (the width of the channel can vary both in the big and in the smaller side), I meant it, i.e. parts of the object with different characteristics (width)... – Cyril Mikhalchenko Oct 04 '18 at 06:18
  • OK, I understand. The variation is too much to break it up into separate parts. It would take way to long to do and therefore become counter productive. In an academic situation it makes sense but for real world application it is not practical. – brink Oct 04 '18 at 16:33