0

I have shapefiles pertaining to NYC traffic density as well as NYC trucking routes, and what I'd like to do is join the attribute data from the trucking route file into the traffic file.

Seen here, blue is the traffic data and red is the trucking route data. In the trucking route attribute table is a column (titled TruckRoute) indicating that yes, this stretch of road is indeed a trucking route. Because only the trucking roads are included, there is only one value for that variable.

enter image description here

What I want to do: I want to get that TruckRoute column into the attribute table for my traffic data shapefile, so that when I eventually cross-reference this with another data source I can have traffic data and truck route data for any given point. I realize that for the non-overlapping street that column won't port over, but I can address that in R later on.

What I've tried: I tried just doing a standard spatial join (Vector -> DM tools -> Join attributes by location) but if it works at all, I only end up with null values in the TruckRoute column of the traffic attribute table, regardless of the settings I use. I tried manually creating the TruckRoute column in the traffic attribute table so that they would have that variable in common, but no dice.

I've also tried creating a small buffer around the traffic line layer so that the truck line layer would be well within it. Same result.

I've tried converting the layers to points and polygons, and doing a spatial join with every combination. No luck.

Any suggestions?

  • The "common field" of a spatial join is the geometry. – Vince Mar 29 '18 at 23:46
  • Here's a basic question: are you sure the layers are in the same CRS? – blackthorn Mar 30 '18 at 11:34
  • Yeah, everything's in WGS 84 – rustynip Mar 30 '18 at 23:38
1

I think I found the solution. I had to convert my traffic line vectors into point vectors, then use MMGIS to create a buffer around each point. I then joined attributes by location, using intercept as the geometric predicate.

This seems to result in traffic points that contain the truck attributes from the underlying truck line vector.

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.