-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match multiple parts of the route individually in case of self-intersection #79
base: main
Are you sure you want to change the base?
Match multiple parts of the route individually in case of self-intersection #79
Conversation
Aren't we having the same problem with invalid matches again, if we extend this part? A traffic light might gets projected on two different route segments at the intersection point. @PhilippMatthes |
@adeveloper-wq yes you are right. Then we should only extrend the ingress and egress parts |
@adeveloper-wq actually now that I think about it, we should cut the loop part to the length the other segments are elongated. Otherwise the projection of the loop could be interpreted as a turn, if you know what I mean |
I just wanted to write the same. 👍 |
buffer = 100 # distance in meter | ||
buffer_wgs84 = buffer / 40000000.0 * 360.0 # wgs84 | ||
for part in unary_union: | ||
buffered = route_linestring.intersection(part.buffer(buffer_wgs84)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part is also not really working. When we intersect the complete route linestring with the buffered segments, intersections of the route linestring are also going to lay in the buffer polygon. Therefore, the intersection of the route_linestring
with the buffer polygon will likely result in a MultiLinestring for those cases. Or in a single Linestring, but where we still have the intersection in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution would be to elongate / shorten along the line, which is a bit more implementation work but should be easy.
Closes: #69
In #69 we discussed a bit about routes that intersect with themselves. This leads to the issue that traffic light geometries may not be projected onto a continuous segment of the route, impairing the matching. With this PR I propose a solution to this issue.
The idea is to split the route at the intersection point into three parts and elongate them:
In this way each part keeps important shape information about the road crossing at which the intersection occurred, without cutting the geometries in the middle. See screenshot below that illustrates the overlap:
The traffic lights matched to each individual elongated segment are combined and duplicates eliminated.
@adeveloper-wq please evaluate my possible solution with a few more examples when you are back from vacation.