2

I want to get points at the intersections of the road network. I have a single shapefile. It contains 100k features and some of them continue each other. enter image description hereRoads shapefile

As can be seen from 2 pictures above, the selected feature doesn't have any intersections between its neighbors, while it has them from QGIS's point of view. I've tried the solution from Find intersection point in a road network of line shapefile:

  1. Dissolve without attribution the original road network shapefile, which contains 100k features to get one feature containing all roads. It worked perfectly. As a result, I have a new layer with one feature.
  2. Multipart the new layer to Singleparts. After this step I get a new layer, but with the same problem: the one road may have several segments. That's why the Line Intersection doesn't work well.

enter image description here

As you can see, QGIS made an intersection point at the selected road segment, while it must not be done. Any suggestions?

  • 1
    Did you try this as suggested in comments of that post: "It look like your lines are splitted into smaller parts that's why your output return so many points. Try to first dissolve your shapefile without any attribution and after run line intersection again"? Please clarify how to you dissolve, multipart-to-singlepart, etc. – user3386170 May 7 at 14:22
  • @user3386170 thanks for your answer. Yes, I've tried dissolve function and also mentioned this in the text of my question. I did it with Vector -> Geoprocessing Tools -> Dissolve without any attribution. Then I tried Vector -> Geometry -> Multiparts to Singleparts and finally Vector -> Analysis Tools -> Line Intersection. – sailestim May 7 at 17:23
  • Since I have 100k features in my road network shapefile, the merge function instead of dissolve is ineffective by time. 20% of the progress took over 8 hours to compile, so I want to find out another solution – sailestim May 7 at 17:53
  • @user3386170 edited. Hope it will make my problem clearer – sailestim May 7 at 19:29
  • Have you tried zooming in really closely to make sure the segments really connect? Or using snap to replace the ends of the segments to the vertices? Sometimes, it looks like one line but there are tiny gaps that interfere. – user3386170 May 7 at 20:48
1

If your road network has a name attribute or similar, you should be able to do this by dissolving based on attribute(s).

As an example, consider the following road network layer. The layer has been symbolized to have points at the first and last vertices. You can see that, like your data, mine is split into many, many short segments.

segmented road network

  1. I run the Dissolve tool and choose Name as the dissolve field. The results appear similar to before, but by selecting one of the roads, I can see that these are actually multipart, but still distinct features for each road.

dissolved multipart network

  1. I run the Merge lines tool. The output is what I want: connected parts of each road are merged together, but each road is still a distinct feature.

merged network

  1. With the merged roads layer, I can now run the Line intersections tool.
    NOTE: This is where the process laid out in the question breaks down; with a single merged feature, it won't self-intersect anywhere.

Here's the output, with intersections symbolized as Xs. To help illustrate the result, I've included the original network's start and end points, which you can see are no longer included as intersections.

intersected network

An additional benefit of creating line intersections this way is that the intersection layer can retain the attributes of both intersecting features from the lines layer, since we did not do away with the attributes in that initial dissolve. This may not be useful to your particular purpose, but it may be beneficial to manage the output data. You'd only be a field calculation away from something like "Intersection of Avenue X and Street Y" for each intersection.

Finally, be aware that this method isn't perfect. If an otherwise continuous line changes attributes, you may end up with "intersections", as shown below. The tiny dead end in this picture technically has its own name, so it kept it separate.

non-intersection

  • Josh, thanks for your detailed answer. As I understand, your method works for features with attributes which associate separate segments of the one road to to the single one. But what if I have only the geometry and no other attributes. What should I do? – sailestim May 8 at 19:27
  • Where is your data from, that it doesn't have any attributes attached to it? Surely there must be some authoritative source. Or even just pulling from OpenStreetMap if you have to. – JoshC May 8 at 21:25
  • My data is from OSM, but it is low-informative. A lot of attributes are missed. It means that even whole districts may have no information except "HIGHWAY" attribute. Regarding the question, what tool do you use to merge at the step 2? I can't find "Merge lines", only "Merge selected features". In your case, I must have tons of features dissolved by name, therefore I can't select each of them and merge manually every time. – sailestim May 8 at 22:03

Your Answer

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

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