当前位置: 首页>>代码示例>>Python>>正文


Python Line.to_npoints方法代码示例

本文整理汇总了Python中karta.vector.geometry.Line.to_npoints方法的典型用法代码示例。如果您正苦于以下问题:Python Line.to_npoints方法的具体用法?Python Line.to_npoints怎么用?Python Line.to_npoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在karta.vector.geometry.Line的用法示例。


在下文中一共展示了Line.to_npoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_to_npoints_lonlat

# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import to_npoints [as 别名]
 def test_to_npoints_lonlat(self):
     line = Line([(0, 40), (120, 40)], crs=LonLatWGS84)
     points = line.to_npoints(20)
     ans = [Point(v, crs=LonLatWGS84) for v in [(0, 40),
                               (4.006549675732082, 43.200316625343305),
                               (8.44359845345209, 46.2434129228378),
                               (13.382442375999254, 49.09308515921458),
                               (18.894149336762318, 51.705248417290484),
                               (25.03918819127435, 54.027440893063556),
                               (31.85052685770255, 55.99968253476488),
                               (39.31083346558522, 57.55771841446013),
                               (47.329401349484314, 58.6395037346357),
                               (55.7308352362257, 59.194673757153645),
                               (64.26916476377436, 59.19467375715364),
                               (72.67059865051574, 58.639503734635674),
                               (80.68916653441482, 57.557718414460105),
                               (88.14947314229748, 55.999682534764844),
                               (94.96081180872568, 54.02744089306352),
                               (101.10585066323772, 51.705248417290456),
                               (106.61755762400078, 49.09308515921457),
                               (111.55640154654793, 46.24341292283779),
                               (115.99345032426793, 43.2003166253433),
                               (120, 40)]]
     for a,b in zip(points, ans):
         self.assertPointAlmostEqual(a, b)
     return
开发者ID:fortyninemaps,项目名称:karta,代码行数:28,代码来源:geometry_tests.py

示例2: test_to_npoints_cartesian

# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import to_npoints [as 别名]
 def test_to_npoints_cartesian(self):
     line = Line([(0.0, 0.0), (1.0, 2.0), (3.0, -2.0), (4.0, -1.0),
                  (4.0, 3.0), (3.0, 2.0)])
     points = line.to_npoints(20)
     ans = [Point(v) for v in [(0.0, 0.0),
                               (0.318619234003536, 0.637238468007072),
                               (0.637238468007072, 1.274476936014144),
                               (0.9558577020106079, 1.9117154040212159),
                               (1.274476936014144, 1.4510461279717122),
                               (1.59309617001768, 0.8138076599646402),
                               (1.911715404021216, 0.17656919195756826),
                               (2.230334638024752, -0.4606692760495037),
                               (2.5489538720282883, -1.0979077440565757),
                               (2.867573106031824, -1.7351462120636478),
                               (3.294395938694146, -1.7056040613058538),
                               (3.7981771815888177, -1.2018228184111823),
                               (4.0, -0.5729663008226373),
                               (4.0, 0.13948796534818164),
                               (4.0, 0.8519422315190006),
                               (4.0, 1.5643964976898195),
                               (4.0, 2.2768507638606383),
                               (4.0, 2.989305030031457),
                               (3.5037812428946715, 2.503781242894671),
                               (3.0, 2.0)]]
     for a,b in zip(points, ans):
         self.assertPointAlmostEqual(a, b)
     return
开发者ID:fortyninemaps,项目名称:karta,代码行数:29,代码来源:geometry_tests.py

示例3: test_to_npoints_lonlat_precision

# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import to_npoints [as 别名]
    def test_to_npoints_lonlat_precision(self):

        line = Line([(-20.247017, 79.683933), (-20.0993, 79.887917),
            (-19.13705, 80.048567), (-18.680467, 80.089333), (-17.451917,
                80.14405), (-16.913233, 80.02715), (-16.631367, 80.022933),
            (-16.194067, 80.0168), (-15.915983, 80.020267), (-15.7763,
                80.021283)], crs=LonLatWGS84)

        for n in range(2, 30):
            self.assertEqual(len(line.to_npoints(n)), n)
        return
开发者ID:fortyninemaps,项目名称:karta,代码行数:13,代码来源:geometry_tests.py


注:本文中的karta.vector.geometry.Line.to_npoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。