0

I have the shapefiles for the polygon part which are colored as yellow but there is no any specific shapefile for the white parts( roads).

Note: I have seen the same question here as below but it didn't work for me using Qgis 3.16.0 with grass 7.8.4.

and

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • 1
    What do you mean by "didnt work", you get error messages or what? – BERA Oct 28 '20 at 08:30
  • Dear BERA, it says, your shape file doesn't have well defined polygon to extract road center line. In short, the road polygon is empty rather there is a shape file for other Land use Polygon parts. – Mollalign Yizengaw Oct 28 '20 at 09:12
  • 1
    Create a polygon covering you entire shapefile, then use Difference to create the road polygons – BERA Oct 28 '20 at 09:18
  • 1
    Dear BERA, Thank you. I created the road edge lines by using Difference and I exploded these lines for my own road classification. The next question is, how to have the center line for these road edge lines? – Mollalign Yizengaw Oct 28 '20 at 10:40
  • And further in front of you lies a large stone pointer, which says: left you go - use Raven's polygons, right you go - use Triangulation Delaunay, forward you go - into a dark cave (a modified fragment of one folk tale). Where do you want to go? :-)... – Cyril Mikhalchenko Oct 28 '20 at 13:39
  • And here's a hint, if you have geodata in the form of a grid, it's better to go to the right, if the geodata have a curved shape, it's better to go left, and sometimes there are all cases simultaneously... – Cyril Mikhalchenko Oct 28 '20 at 13:51
  • 1
    Dear Cyril Mikhalchenko, I am lucky that you are the one who answered the following question. https://gis.stackexchange.com/questions/318721/creating-centerline-of-river-in-qgis/318733#318733. – Mollalign Yizengaw Oct 28 '20 at 14:02
  • But, do me a favor! Do you think making more dense points in the straight lines will help me to get the perfect center line using the Voronoi Polygons?. – Mollalign Yizengaw Oct 28 '20 at 14:14
  • No Polygons Voronoy will give you a wavy line, which can be corrected with the help of centroids of the segments... If you have polygons in the form of a grid, I will add my answer... – Cyril Mikhalchenko Oct 28 '20 at 14:29
  • Alright. I am waiting. – Mollalign Yizengaw Oct 28 '20 at 14:42
  • Please use the [edit] button beneath your question to revise it with any requested clarifications. – PolyGeo Oct 29 '20 at 20:08

1 Answers1

4

My test source data is a file called "poly_town", almost the same as in your picture, i.e. approximately a grid.

enter image description here

  1. Extract vertices with the geo tool: Vector>Processing geometry>Extract vertices, see the figure below for the result.

enter image description here

  1. Create combined buffers on the selected nodes using the geo tool: Buffer as shown in the figure below

enter image description here

See the figure below for the expected result. enter image description here

  1. Extract centroids on the combined buffer zones at the intersections of blocks, using the geoinstrument: Vector>Processing of geometry>Centroids, the result see the figure below

enter image description here

  1. Perform Delaunay triangulation on these centroids, using: Vector>Processing geometry>Triangulation Delaunay, hereinafter
  • convert polygons into lines with the geo tool: Vector>Processing geometry>Convert polygons into lines,

  • then blow them up with: Analysis Tools>Vector Geometry>Blow up Lines, see the figure below

enter image description here

  1. Select the required blasted lines that do not fall into quarters using the geo tool: Analysis tools>Vector selection>Extract by spatial position see the figure below enter image description here

  2. Delete unnecessary artifacts and save the result as a new file using <Export>-<Save objects as... >...

see the figure below

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Cyril Mikhalchenko
  • 4,397
  • 7
  • 14
  • 45
  • Wow. Thank you, Cyril Mikhalchenko – Mollalign Yizengaw Oct 29 '20 at 10:01
  • 1
    Dear Cyril Mikhalchenko, I checked it. But, I got some errors related to vertices generation for the lines which have had vertices at the middle, besides to edge corner vertices. One thing, i say for sure is, the method you told me is perfect for case of grid vertices which has only one vertices at corner of each block. – Mollalign Yizengaw Oct 29 '20 at 13:22
  • Cherry on the cake of this method is that you must first create additional corresponding points on the opposite sides of your neighborhoods if there are none... i.e. there must be 2 points on each side (1+1) or 4 (2+2).... – Cyril Mikhalchenko Oct 29 '20 at 13:35
  • Would you tell me the method to create additional corresponding points for all of unforeseen situations? is it by making denser points? – Mollalign Yizengaw Oct 29 '20 at 13:45
  • So far, from the QGIS geoinstrument set, the most optimal solution is the "Transects" geoinstrument on blasted lines, which makes it possible to lengthen them by a certain distance... – Cyril Mikhalchenko Oct 29 '20 at 18:29