I am working on a project in QGIS georeferencing and merging some raster maps that include road data. In the original raster the roads have data assigned to them according to their color in the raster.

I have georeferenced the rasters, used GRASS's r.thin to thin the resulting road lines, and used r.to.vect to convert them to vectors. What I end up with is a set of road lines that are jagged because of the raster pixels.

I would like to take the attributes of this layer (based on the original color) and join them with a more well established and accurate road shapefile that I downloaded from the internet that would add road names, county information, etc.

The picture below shows the two layers. The distance varies across the area of interest but at max is about 40 meters off. The red is the "actual" road shapefile and the black is the raster to vector conversion.

I could use the join attributes by nearest tool, however this joins some raster road attributes to roads that are not shown in the original raster (i.e. neighborhood roads or dead end roads) (see picture). Is there a way to match up these almost identical layers or to join the line features based on an average distance across their length rather than intersections?

On the other hand, would it be easier to go the opposite direction and assign data to the "actual" road vector features by the raster colors they overlap? (see second image) Could I still exclude those dead end roads that are not included in the original raster?

enter image description here

enter image description here

1 Answer 1


Create a small buffer around your black raster roads, than select all red, "actual" roads that are within that buffer (or: that have a minimal percentage of their length inside the buffer). Optionally, reduce line length at start- and end point of red lines so that the start of dead ends will not fall inside the buffer.

Delete all red roads that are not selected: that will be the dead ends.

Now, you should be able to join.

For joining, you could also use an approach described here to join each line segment of the "black" to the nearest line segment of the "red" line: https://gis.stackexchange.com/a/384194/88814

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.