1

I have a road network layer that has a unique id "ID_2" for each road segment. I also have a table that contains the route for each bus network. Each row in this table contains the name of the bus and the road that the bus travels in the form of "ID_2".

I want to join these two in such a way that my road network layer must contain all the bus route numbers for each road segment.

Is there a way to do this in QGIS?

Edit: I have tried the following procedure already

Using relations: With parent as my road network layer and child as my bus route table and ID_2 as the relation. But I don't see it when I select the road network layer information.

Using join: This gives me only one route number for every road segment while actually each road segment could cater to multiple routes.

  • I used relations first. With parent as my road network layer and child as my bus route table and ID_2 as the relation. But i don't see it when I select the road network layer information. I also did a direct join but it gives me only one route number for every road segment while actually each road segment could cater multiple routes. – Ganesh Ambi Ramakrishnan May 11 at 5:13
4

You may have tried Join attributes by field value already; just make sure to select Create separate feature for each matching feature (one-to-many) option.

enter image description here

| improve this answer | |
  • Hi, thanks. I did the above join and it worked. But the problem is the resultant layer seems to show the same row of road segment multiple times depending upon how many routes is served. Although technically that is what the join should do, is it possible to maintain the original road segment (without duplicate rows) but say have multiple columns for route names? I know that this can be done by exporting both tables and just do it using a program and then bring it back to qgis. but is there a better way to map this inside qgis ? – Ganesh Ambi Ramakrishnan May 12 at 4:27
  • @GaneshAmbiRamakrishnan Common approach would be using concatenate() function to group them into single row. But it would be rather difficult to separate them into multiple columns, because it is usually difficult to know number of required columns beforehand. – Kazuhito May 12 at 4:42

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.