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


Python Point.vertex方法代码示例

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


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

示例1: TestGeometryProj

# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import vertex [as 别名]
class TestGeometryProj(unittest.TestCase):

    def setUp(self):
        self.vancouver = Point((-123.1, 49.25), crs=LonLatWGS84)
        self.ottawa = Point((-75.69, 45.42), crs=LonLatWGS84)
        self.whitehorse = Point((-135.05, 60.72), crs=LonLatWGS84)
        return

    def test_greatcircle(self):
        d1 = self.vancouver.distance(self.ottawa)
        d2 = self.vancouver.distance(self.whitehorse)
        d3 = self.whitehorse.distance(self.ottawa)
        d4 = self.whitehorse.distance(self.vancouver)
        self.assertAlmostEqual(d1, 3549030.70541, places=5)
        self.assertAlmostEqual(d2, 1483327.53922, places=5)
        self.assertAlmostEqual(d3, 4151366.88185, places=5)
        self.assertAlmostEqual(d4, 1483327.53922, places=5)
        return

    def test_greatcircle_projected(self):
        van = Point(self.vancouver.vertex(GallPetersEqualArea), crs=GallPetersEqualArea)
        whi = Point(self.whitehorse.vertex(GallPetersEqualArea), crs=GallPetersEqualArea)
        ott = Point(self.ottawa.vertex(GallPetersEqualArea), crs=GallPetersEqualArea)

        d1 = van.distance(ott, projected=False)
        d2 = van.distance(whi, projected=False)
        d3 = whi.distance(ott, projected=False)
        d4 = whi.distance(van, projected=False)
        self.assertAlmostEqual(d1, 3549030.70541, places=3)
        self.assertAlmostEqual(d2, 1483327.53922, places=3)
        self.assertAlmostEqual(d3, 4151366.88185, places=3)
        self.assertAlmostEqual(d4, 1483327.53922, places=3)
        return

    def test_azimuth_lonlat(self):
        """ Verify with
        echo "49.25dN 123.1dW 45.42dW 75.69dW" | invgeod +ellps=WGS84 -f "%.6f"
        """
        az1 = self.vancouver.azimuth(self.ottawa)
        az2 = self.vancouver.azimuth(self.whitehorse)
        self.assertAlmostEqual(az1, 78.483344, places=6)
        self.assertAlmostEqual(az2, -26.135827, places=6)
        return

    def test_walk_lonlat(self):
        start = Point((-132.14, 54.01), crs=LonLatWGS84)
        dest = start.walk(5440.0, 106.8)
        self.assertAlmostEqual(dest.x, -132.0605910876)
        self.assertAlmostEqual(dest.y, 53.99584742821)
        return
开发者ID:fortyninemaps,项目名称:karta,代码行数:52,代码来源:geometry_tests.py

示例2: test_vertices_in_crs2

# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import vertex [as 别名]
 def test_vertices_in_crs2(self):
     point = Point((-123.0, 49.0), crs=LonLatWGS84)
     BCAlbers = ProjectedCRS("+proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 "
                 "+lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +datum=NAD83 "
                 "+units=m +no_defs", "BC Albers")
     self.assertTupleAlmostEqual(point.vertex(BCAlbers),
                                 (1219731.770879303, 447290.49891930853))
     return
开发者ID:fortyninemaps,项目名称:karta,代码行数:10,代码来源:geometry_tests.py

示例3: test_vertices_in_crs

# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import vertex [as 别名]
 def test_vertices_in_crs(self):
     point = Point((-123.0, 49.0), crs=SphericalEarth)
     self.assertEqual(point.vertex(SphericalEarth), (-123.0, 49.0))
开发者ID:fortyninemaps,项目名称:karta,代码行数:5,代码来源:geometry_tests.py

示例4: test_point_vertex

# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import vertex [as 别名]
 def test_point_vertex(self):
     point = Point((1.0, 2.0, 3.0))
     self.assertEqual(point.vertex(), (1.0, 2.0, 3.0))
     return
开发者ID:fortyninemaps,项目名称:karta,代码行数:6,代码来源:geometry_tests.py


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