def validate_intersection(self, line_index, point):
"""
Validate the intersection between given line and point.
A spatial tolerance is considered to confirm the validation.
:param line_index: index of specific line
:param point: validated point
:return: coordinates of intersected point on line, otherwise None
"""
line = self.geoms[line_index]
coords = list(line.coords)
buffered_point = Point(point).buffer(self.point_buffer)
touched = None
if line.intersects(buffered_point):
cut = point_projects_to_line(point, line)
touched = coords[cut]
self._update_cut(line_index, cut)
return touched
评论列表
文章目录