I'm looking to add traffic data linked to a polyline shapefile of road centerlines to a multipolygon shapefile of land parcels. I want to join this data using proximity to roads instead of by matching addresses to create the most accurate traffic data (i.e. if a parcel is addressed on a side road but is cornered on a major thoroughfare). Inevitably, many parcels will have multiple traffic data inputs since one parcel can be near multiple roads. Many road lines will also be sharing information with multiple parcels.

I created a buffer for the road centerline to overlap with parcels nearby. I then used the "Join attributes by location" to input traffic data onto the parcel shapefile. I selected the "one to many" feature to get all relevant traffic info onto each parcel polygon.

The join created several superimposed polygons for each parcel, each with different traffic data from a different individual neighboring road (which I feared would happen). This functionally works for my purposes but is very inefficient. The file is multiple times the size it needs to be and is delayed in loading with each pan/zoom action.

How can I converge multiple traffic data points into one polygon, instead of assigning one polygon per traffic data point?

One acceptable, but less than ideal, solution will be to only accept the polygon with the greatest traffic flow, but I'm unsure of how to filter and eliminate polygons in that way.


I have found the RefFunctions plugin to be helpful with these types of joins. Within that plugin, I use the geomnearest expression.

I used this feature frequently on a project that required addresses to be associated with tree points. The street centrelines had the street names, and so to save time in the field, I pre-populated existing tree points with the street names using geomnearest.

For your example, I've mocked up some sample data to show how it works:

This is our starting map with the Roads layer and Parcels layer This map shows our example layers - Roads_Sample and Parcels_Sample

This is the attribute properties for the fields in the Roads layer These are the fields in the Roads_Sample layer. For this example, I'll take the closest values from 'full_name' and add it to the parcels layer. You must be aware of the input type and length.

Parcels layer with a new field for the Road names I added the field 'Road_name'to the parcels layer. This is the layer into which I'll put the road names from the Road_Sample layer using the geomnearest expression.

Field calculator example This is the expression using the example data. You can see that the output preview is showing something not null (and not invalid) - this always makes me happy. :)

Attribute data sample You can see that there are names in the Road_Names field. And to check, I can just label the features to make sure the analysis got most of the information correct.

Sample map to do QA This looks good. There may be errors at the street corners, since property frontages may be one or the other. But for the great majority of the parcels I am confident that the information is correct.

For your application, you'll have to be aware of the possible sources of error. I would expect some doubt where there are potentially multiple road segments within range of single parcels, in which case you're only going to get data from one segment.

Something to note is that this can be very computationally intense - the spatial query considers all features in both databases. I used a small sample set (58 road segments to be queried by 1105 parcels) for this example. When I did the work for the street names and trees, it took hours because I had about 35,000 trees and a lot of road segments over a large area. So give yourself time (i.e., run the query before you go home for the night) or use a spare machine.

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.