本文整理匯總了Python中karta.vector.geometry.Multipoint.coords方法的典型用法代碼示例。如果您正苦於以下問題:Python Multipoint.coords方法的具體用法?Python Multipoint.coords怎麽用?Python Multipoint.coords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類karta.vector.geometry.Multipoint
的用法示例。
在下文中一共展示了Multipoint.coords方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_multipoint_output
# 需要導入模塊: from karta.vector.geometry import Multipoint [as 別名]
# 或者: from karta.vector.geometry.Multipoint import coords [as 別名]
def test_multipoint_output(self):
p = Multipoint([(4, 2), (3, 5), (3, 2), (7, 3)])
sp = shapely.geometry.shape(p.geomdict)
x, y = p.coords()
self.assertTrue(np.all(x == np.array([el.x for el in sp])))
self.assertTrue(np.all(y == np.array([el.y for el in sp])))
return
示例2: test_read_points
# 需要導入模塊: from karta.vector.geometry import Multipoint [as 別名]
# 或者: from karta.vector.geometry.Multipoint import coords [as 別名]
def test_read_points(self):
points = read_shapefile(os.path.join(TESTDATA, "shapefile", "points"))
self.assertEqual(len(points), 4)
pt = points[0]
self.assertTrue("+proj=lonlat" in pt.crs.get_proj4())
self.assertTrue("+a=6378137.0" in pt.crs.get_proj4())
self.assertTrue("+f=0.00335281" in pt.crs.get_proj4())
mp = Multipoint(points)
self.assertEqual(mp.d["species"], ['T. officianale', 'C. tectorum', 'M. alba', 'V. cracca'])
self.assertEqual(mp.d["ID"], ['0', '1', '2', '3'])
x, y = mp.coords()
self.assertTrue(np.all(x == np.array((1.0, 3.0, 4.0, 2.0))))
self.assertTrue(np.all(y == np.array((1.0, 1.0, 3.0, 2.0))))