本文整理汇总了Python中karta.vector.geometry.Line.to_points方法的典型用法代码示例。如果您正苦于以下问题:Python Line.to_points方法的具体用法?Python Line.to_points怎么用?Python Line.to_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Line
的用法示例。
在下文中一共展示了Line.to_points方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_points_cartesian
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import to_points [as 别名]
def test_to_points_cartesian(self):
line = Line([(0.0, 0.0), (4.0, 3.0), (1.0, 7.0)])
points = line.to_points(1.0)
ans = [(0., 0.), (0.8, 0.6), (1.6, 1.2), (2.4, 1.8), (3.2, 2.4),
(4., 3.), (3.4, 3.8), (2.8, 4.6), (2.2, 5.4), (1.6, 6.2),
(1., 7.)]
self.assertEqual(len(points), len(ans))
for pt, vert in zip(points, ans):
self.assertAlmostEqual(pt.x, vert[0])
self.assertAlmostEqual(pt.y, vert[1])
return
示例2: test_to_points_lonlat
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import to_points [as 别名]
def test_to_points_lonlat(self):
line = Line([(0.0, 38.0), (-10.5, 33.0), (-6.0, 35.0)], crs=LonLatWGS84)
points = line.to_points(100000.0)
ans = [( 0. , 38. ), ( -1.00809817, 37.58554833),
( -2.01066416, 37.17113146), ( -3.00781084, 36.7567488 ),
( -3.99964867, 36.34239982), ( -4.98628577, 35.92808398),
( -5.96782797, 35.51380078), ( -6.94437893, 35.09954973),
( -7.91604017, 34.68533037), ( -8.88291117, 34.27114226),
( -9.84508939, 33.85698498), (-10.80267038, 33.44285814),
(-10.09466286, 33.19083929), ( -9.15505703, 33.62895663),
( -8.21064326, 34.0669835 ), ( -7.26131724, 34.5049191 ),
( -6.30697252, 34.94276264)]
self.assertEqual(len(points), len(ans))
for pt, vert in zip(points, ans):
self.assertAlmostEqual(pt.x, vert[0])
self.assertAlmostEqual(pt.y, vert[1])
return