本文整理汇总了Python中karta.vector.geometry.Line.shortest_distance_to方法的典型用法代码示例。如果您正苦于以下问题:Python Line.shortest_distance_to方法的具体用法?Python Line.shortest_distance_to怎么用?Python Line.shortest_distance_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Line
的用法示例。
在下文中一共展示了Line.shortest_distance_to方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_connected_multipoint_shortest_distance_to2
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import shortest_distance_to [as 别名]
def test_connected_multipoint_shortest_distance_to2(self):
line = Line([(127.0, -35.0), (132.0, -28.0), (142.0, -29.0)], crs=LonLatWGS84)
dist = line.shortest_distance_to(Point((98.0, -7.0), crs=LonLatWGS84))
self.assertAlmostEqual(dist, 4257313.5324397, places=6)
return
示例2: test_connected_multipoint_shortest_distance_to
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import shortest_distance_to [as 别名]
def test_connected_multipoint_shortest_distance_to(self):
line = Line([(0.0, 0.0), (2.0, 2.0), (5.0, 4.0)])
dist = line.shortest_distance_to(Point((0.0, 2.0)))
self.assertTrue(abs(dist - math.sqrt(2)) < 1e-10)
return