I am working with QGIS.

The aim of the task is to label (auto populate) the 'Road From' and 'Road To' columns in the attribute table based on which roads the street intersects with.

Looking at the example below. Central Ave is divided into segments based on the intersections as highlighted in red below. I want the attribute table to auto populate this row in the Road From and Road To columns to ‘Deakin St’ and ‘Barton St’.

Is it possible to write a code in the field calculator to tell the Road From column to fill according to the ‘Road name’ of the line it intersects with.

I guess the issues (besides can this be done) are that Central Ave intersects with itself as well as Deakin St. So the code will have to specify ‘does not equal itself’. Another one is can you tell it to fill the Road To colum … from the other road it did not put in the Road From Column.

To answer a question I got: No, I am not familiar with python (although when I was researching I did notice people using it) ... and Yes, I did look around at the plugins available. Do you think that Python is the potential answer ?

enter image description here enter image description here

  • 1
    Welcome to GIS SE. Thanks for putting effort into your question. If you'd like to take a tour of the site you'll get a badge: gis.stackexchange.com/tour.
    – jbalk
    Oct 14, 2016 at 5:22
  • 1
    I have some questions - please add the answers into your question (edit your question): Do you know python? Have you searched the plugins for a suitable option?
    – jbalk
    Oct 14, 2016 at 5:26

1 Answer 1


Thanks for everyone's input ... I just thought I would post what I did as this project is now finished and some people may find this question in the future whilst googling a similar problem.

I investigated using code such as python to do what I needed to do. However, I just found there would be too many variables in order for the columns to auto populate. I would inevitably need to check the data anyway. So, I did the project manually. 2,900 rows ... nearly 6,000 entries.

In QGIS I sorted my attribute table into ROAD NAME alphabetically. I selected the first row, then panned to the selection on the map. I then looked at the street and decided which way the network was to flow. If there were multiple sections of the road I would make all my FROM's and TO's would ensure a street flowed in the one direction. I also made sure the direction was from a main street heading towards a minor street, or to the end ... if applicable.

I would then edit the attribute table in the Road from and Road to columns. I made these columns use a drop down list of the road names to ensure spelling was uniform and ease of data entry.

Using this method I was also able to check the topology by merging or splitting line that were missed in the initial topology stage.

3 days of hardcore data entry ... it was finished.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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