0

I am trying to clean up a road network file. The roads are encoded as multlinestrings I want them as linestrings.

Normally I would use st_mergeline to convert from a multilinestring to linestring. But my issues is that some of the multilinestring include 1 or more holes/breaks in the linestring. enter image description here

Where the two lines represent two multilinestring I am just wondering if there is a sly way of inserting a bridge between the two strings. This issue is come with about 30% of my data. I could resolve this issue by editing data with qgis. But there must be a better way of sorting this problem out that hand editing all that data. Using functions like st_union result in a single geometry object with it includes the break. I want to joint the two segments together.

  • this is not trivial; there are the ST_Snap or ST_SnapToGrid functions that you could try to carefully apply on the vertices of the linestrings. pgRouting has efficiently implemented that in it's pgr_nodeNetwork function that might be a good option, also if you plan to do routing. PostGIS topology functions could also be applied here, but that requires some work on the data I guess. – ThingumaBob May 19 '18 at 6:45
  • Thanks, I resolve my problem by fixing the data source. I did try some of the postgres topolgical tools as well with mixed results There is a blog about using Postgis topologies to clean up road networks at blog.mathieu-leplatre.info/… – Dave May 20 '18 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.