Tuesday 28 May 2019

qgis - Merging close lines using v.clean



I downloaded some road network data derived from OSM by GeoFabrik, see the initial state: Near Székesfehérvár (Hungary) Near Székesfehérvár (Hungary), parallel lines are probably trunk or motorway roads.


I would like to simplify it like this (drawn in Paint): enter image description here


I would like to use open source stuff for that (QGIS, GRASS), so I tried v.clean and v.simplify, v.generalize in some combination. Unfortunately, I cannot reach the desired result.


With v.clean 'snap' method, tolerance=50 I reached this:


After v.clean snap.


But I don't need duplicated geometries, or identical zig-zag lines. Probably the v.generalize.network (Closeness, Betweeness threshold) would solve the problem, if it worked.


You can download the clipped geodata here: https://github.com/ewirth/gistemp



Answer



Buffering the road may be a solution to this problem.





  • create a dissolved buffer of the road using around 20 unit map distance. enter image description here




  • import the layer into a postgis database and create the middle line using ST_ApproximateMedialAxis() function:





SELECT ST_ApproximateMedialAxis(geom) AS geom INTO road_centre_line FROM road_buffer;





  • in order to access this function you have to enable the postgis_sfcgal extension

  • with this you will get an output like this enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...