本文整理汇总了Python中karta.vector.geometry.Point.azimuth方法的典型用法代码示例。如果您正苦于以下问题:Python Point.azimuth方法的具体用法?Python Point.azimuth怎么用?Python Point.azimuth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Point
的用法示例。
在下文中一共展示了Point.azimuth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestGeometryProj
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [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.assertTrue(abs(d1 - 3549030.70541) < 1e-5)
self.assertTrue(abs(d2 - 1483327.53922) < 1e-5)
self.assertTrue(abs(d3 - 4151366.88185) < 1e-5)
self.assertTrue(abs(d4 - 1483327.53922) < 1e-5)
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
示例2: test_azimuth
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [as 别名]
def test_azimuth(self):
for crs in (SphericalEarth, LonLatWGS84):
pt0 = Point((0.0, 0.0), crs=crs)
pt1 = Point((-1.0, 1.0), crs=crs)
pt2 = Point((-179.5, 0.0), crs=crs)
pt3 = Point((179.5, 1.0), crs=crs)
self.assertAlmostEqual(pt0.azimuth(pt1), pt2.azimuth(pt3), places=8)
示例3: TestGeometryProj
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [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
示例4: test_point_azimuth_projected
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [as 别名]
def test_point_azimuth_projected(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 -w6 | tr '\n' ' ' | invgeod +ellps=WGS84 -f "%.6f"
and
cat <(printf "0 -1000000" | 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 -w6) <(printf "100000 -900000" | proj +proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +units=m +datum=WGS84 +no_defs -I -s -w6) | 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)
other = Point((1e5, -9e5), crs=NSIDCSouth)
self.assertAlmostEqual(point.azimuth(other, projected=False), -117.140678, places=6)
return
示例5: test_point_azimuth3
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [as 别名]
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), 45.036973, places=6)
return
示例6: test_point_azimuth
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [as 别名]
def test_point_azimuth(self):
point = Point((1.0, 2.0))
other = Point((2.0, 3.0))
self.assertEqual(point.azimuth(other), 0.25*180)
other = Point((0.0, 3.0))
self.assertEqual(point.azimuth(other), -0.25*180)
other = Point((0.0, 1.0))
self.assertEqual(point.azimuth(other), -0.75*180)
other = Point((2.0, 1.0))
self.assertEqual(point.azimuth(other), 0.75*180)
other = Point((1.0, 3.0))
self.assertEqual(point.azimuth(other), 0.0)
other = Point((1.0, 1.0))
self.assertEqual(point.azimuth(other), -180.0)
return
示例7: test_point_azimuth_nan
# 需要导入模块: from karta.vector.geometry import Point [as 别名]
# 或者: from karta.vector.geometry.Point import azimuth [as 别名]
def test_point_azimuth_nan(self):
point = Point((5.0, 2.0))
other = Point((5.0, 2.0))
self.assertTrue(np.isnan(point.azimuth(other)))
return