2

I'm often working with different polyline datasets which represent street networks. One of the most common tasks I have is to join information from one layer to another. Often there are no mutual attributes to utilize.

Geometries between layers are similar, but they're far from identical. First thought would be to use spatial join based on argument closest. Alongside the fact that the argument doesn't exist in core QGIS function, as far as I know it is based on a single, closest vertex. Since we're talking about wide road networks, the single, closest vertex might not be the correct one (see image). It's more about two lines sharing approximately the same path.

In the image, based on approximate paths of the three lines shown, the orange line should be joined with the blue one. Yet, since a vertex of the green line is the closest to any of the vertices of the orange line, the join would actually happen between them.

So I reckon the solution should take into account all of the vertices, get their closest counterpart and do a join based on their majority.

My question is: are there any existing open source tools or combination of them that could tackle this efficiently or should I start planning a script?

I'm using QGIS 3.4 on Windows.

enter image description here

  • One practical, quick and dirty solution might be to buffer the counterpart layer and then do spatial join based on a within / contains argument, though that's not exactly what I'm looking for here. – Ville Koivisto Mar 4 at 7:26
  • Looking for the very same. Must be possible? – Ken May 16 at 13:13
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – smiller May 16 at 13:37
  • Maybe you can flag each road as closest to Horizontal or Vertical. This might help join the appropriate feature. – klewis May 16 at 17:10
  • @klewis Do you have a proposal how to deduce vertical or horizontal orientation for roads in your given context? On another note, I've learned that QGIS 3.8 will finally have spatial join by argument closest, but it is unclear if it will contain an option to execute it by majority or average of vertices. – Ville Koivisto May 17 at 5:49

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.