0

I have a shapefile with a regional travel model comprised of straight line features (model.shp, blue in the image). These lines roughly match the actual paths of the roadways they represent (road.shp, magenta in the image). I need to copy traffic volume data from road.shp to the model.shp.

enter image description here

Some of the issues I see right away are:

  • There is no attribute data (roadway name, segment, intersection, etc) to compare between the two datasets. This means the comparison will have to be done based on their spatial relationship to one another
  • Single lines in model.shp are often comprised of multiple segments in road.shp. This means that many segments in model.shp will have multiple attribute matches (one for each segment in road.shp that falls along the path of a feature in model.shp), and the locations of the beginning and end of each segment will sometimes be very different.
  • The paths of the lines are not very close to each other. This means that there is no simple spatial query that can be done to select by the relationship of their locations to one another.

The locations of the intersections is the areas that are the closest between the two datasets, and I think that is the best way to go about linking the two together. My initial thought is that the best way to go about this is to make a tool to:

  1. Calculate the coordinates of the beginning and end of each line in road.shp.
  2. Create a straight line segment from that coordinate information in a new shapefile (roadstraight.shp, carrying over the traffic count number we want to copy to model.shp
  3. This should result in a dataset comprised of straight lines which should be closer to the model.shp data
  4. For each line segment in roadstraight.shp, conduct a spatial search for each model.shp line segment within X feet (or the closest X number of lines)
  5. Calculate the slope of each line that was selected to determine which line follows the closest path to the segment in question

Does it seem like I am on the right track with this?

tldr: need help to match lines from one shapefile to another based on how similar they are in shape and path.

2
  • You could try buffering both, intersect, dissolve, then find which two roads share the biggest area. Then join by this
    – Bera
    Commented Oct 28, 2020 at 13:01
  • I like this approach! I will give this some serious thought as well.
    – tacarn
    Commented Oct 28, 2020 at 13:25

1 Answer 1

2

As you state in your question you have realised that there is "no simple spatial query" that will resolve this and you are going to have exceptions to the rule. I don't think there is one magic tool or workflow that will resolve all this and it will be a compromise of diminishing returns with you ultimately having to fix some/many of them manually.

If you use the dissolve tool on your roads you could dissolve the segments between road junctions, see unsplit parameter. So no need to generate straight line equivalents to your model data.

I would then extract the centroids of the two layers and run generate near table tool to locate the nearest centroid from one layer to the other, this essentially creates a lookup table. The bulk of your data should match leaving the remaining lines unmatched, especially if you place a search tolerance.

You'll get erroneous matches but you could quality control the data and compare the matched line lengths as a first pass, if the model road is say 50% longer than the dissolved road then probably something went wrong...

Just looking at the image I see modelled roads crossing at least 2 roads and roads that have no equivalent modelled line, so how to deal with those?

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.