Say I have the following Polygon and Point:
>>> poly = Polygon([(0, 0), (2, 8), (14, 10), (6, 1)])
>>> point = Point(12, 4)
I can calculate the point's distance to the polygon...
>>> dist = point.distance(poly)
>>> print(dist)
2.49136439561
...but I would like to know the coordinate of the point on the polygon border where that shortest distance measures to.
My initial approach is to buffer the point by its distance to the polygon, and find the point at which that circle is tangent to the polygon:
>>> buff = point.buffer(dist)
However, I'm not sure how to calculate that point. The two polygon's don't intersect so list(poly.intersection(buff))
will not give me that point.
Am I on the right track with this? Is there a more straightforward method?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…