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


Python Multipoint.nearest_vertex_to方法代码示例

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


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

示例1: test_nearest_to

# 需要导入模块: from karta.vector.geometry import Multipoint [as 别名]
# 或者: from karta.vector.geometry.Multipoint import nearest_vertex_to [as 别名]
 def test_nearest_to(self):
     point = Point((1.0, 2.0, 3.0), properties={"type": "apple", "color": (43,67,10)})
     mp = Multipoint(self.vertices, data=self.data)
     self.assertEqual(mp.nearest_vertex_to(point), 12)
     return
开发者ID:fortyninemaps,项目名称:karta,代码行数:7,代码来源:geometry_tests.py

示例2: TestGeometryAnalysis

# 需要导入模块: from karta.vector.geometry import Multipoint [as 别名]
# 或者: from karta.vector.geometry.Multipoint import nearest_vertex_to [as 别名]

#.........这里部分代码省略.........
        other = Point((1.0, 1.0))
        self.assertEqual(point.azimuth(other), -180.0)
        return

    def test_point_azimuth2(self):
        point = Point((5.0, 2.0))
        other = Point((5.0, 2.0))
        self.assertTrue(np.isnan(point.azimuth(other)))
        return

    def test_point_azimuth3(self):
        """ Verify with:

        printf "0 -1000000\n100000 -900000" | proj +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +units=m +datum=WGS84 +no_defs -I -s | tr '\n' ' ' | invgeod +ellps=WGS84 -f "%.6f"
        """
        point = Point((0.0, -10e5), crs=NSIDCNorth)
        other = Point((1e5, -9e5), crs=NSIDCNorth)
        self.assertAlmostEqual(point.azimuth(other, projected=False), 45.036973, places=6)
        return

    def test_point_shift_inplace(self):
        point = Point((-3.0, 5.0, 2.5), properties={"type": "apple", "color":(43,67,10)})
        point.shift((4.0, -3.0, 0.5), inplace=True)
        self.assertEqual(self.point, point)
        return

    def test_point_shift(self):
        point = Point((-3.0, 5.0, 2.5), properties={"type": "apple", "color":(43,67,10)})
        point_shifted = point.shift((4.0, -3.0, 0.5))
        self.assertEqual(self.point, point_shifted)
        return

    def test_nearest_to(self):
        self.assertEqual(self.mp.nearest_vertex_to(self.point), 12)
        return

    def test_multipoint_shift_inplace(self):
        vertices = [(a-1,b+2,c-0.5) for (a,b,c) in self.vertices]
        mp = Multipoint(vertices, data=self.data)
        mp.shift((1, -2, 0.5), inplace=True)
        self.assertEqual(mp, self.mp)

    def test_multipoint_shift(self):
        vertices = [(a-1,b+2,c-0.5) for (a,b,c) in self.vertices]
        mp = Multipoint(vertices, data=self.data)
        mp_shifted = mp.shift((1, -2, 0.5))
        self.assertEqual(mp_shifted, self.mp)
        return

    def test_multipoint_bbox(self):
        bbox = (1.0, 0.0, 9.0, 9.0)
        self.assertEqual(self.mp.bbox, bbox)
        return

    def test_multiline_bbox(self):
        geom = Multiline([[(1,2), (3,4), (3,2)],
                          [(6,8),(2,6),(3,0)],
                          [(-3,-4), (7, -1), (3, 2), (2, -3)]],
                         crs=LonLatWGS84)
        self.assertEqual(geom.bbox, (-3, -4, 7, 8))
        return

    def test_multipolygon_bbox(self):
        geom = Multipolygon([[[(1,2), (3,4), (3,2)]],
                             [[(6,8),(2,6),(3,0)]],
                             [[(-3,-4), (7, -1), (3, 2), (2, -3)]]],
开发者ID:ivn888,项目名称:karta,代码行数:70,代码来源:geometry_tests.py


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