本文整理汇总了Python中utm.to_latlon方法的典型用法代码示例。如果您正苦于以下问题:Python utm.to_latlon方法的具体用法?Python utm.to_latlon怎么用?Python utm.to_latlon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utm
的用法示例。
在下文中一共展示了utm.to_latlon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: latlong
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def latlong(pos, zone=None, origin=None):
"""Convert local coordinate system position to latitude/longitude.
To convert a UTM position into a global latitude/longitude, the local coordinate
system has to be specified in terms of a UTM zone 2-tuple, e.g. ``(32, 'U')``.
Alternatively a local coordinate system can be specified in terms of an origin
latitude/longitude.
"""
opos = (0,0)
if origin is not None:
if zone is not None:
raise ValueError('zone and origin cannot be concurrently specified')
origin = _normalize(origin)
opos = _utm.from_latlon(origin[0], origin[1])
zone = (opos[2], opos[3])
geo = _utm.to_latlon(pos[0]+opos[0], pos[1]+opos[1], zone[0], zone[1])
return (geo[0], geo[1], 0.0 if len(pos) < 3 else pos[2])
示例2: test_utm_converter
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def test_utm_converter(reader):
converter = LongLatToUTMConverter(reader)
p_east = float('-inf')
assert converter.zone_number is None
for long, (time, detections) in zip(range(-3, 4), converter):
detection = detections.pop()
assert converter.zone_number == 30
assert converter.northern
assert p_east < detection.state_vector[0]
p_east = detection.state_vector[0]
assert pytest.approx((50, long), rel=1e-2, abs=1e-4) == utm.to_latlon(
*detection.state_vector[0:2], zone_number=30, northern=True)
示例3: read
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def read(self, filename, **kwargs):
header = self.parseHeaderFile(filename)
def load_data(filename):
self._log.debug('Loading %s' % filename)
return num.flipud(
num.fromfile(filename, dtype=num.float32)
.reshape((header.lines, header.samples)))
displacement = load_data(filename)
theta_file, phi_file = self.getLOSFiles(filename)
if not theta_file:
theta = num.full_like(displacement, 0.)
else:
theta = load_data(theta_file)
theta = num.deg2rad(theta)
if not phi_file:
phi = num.full_like(displacement, num.pi/2)
else:
phi = load_data(phi_file)
phi = num.pi/2 - num.rad2deg(phi)
c = self.container
c.displacement = displacement
c.phi = phi
c.theta = theta
map_info = header.map_info
c.frame.dE = float(map_info[5])
c.frame.dN = dN = float(map_info[6])
c.frame.spacing = 'meter'
c.frame.llLat, c.frame.llLon = utm.to_latlon(
float(map_info[3]) - header.lines * dN,
float(map_info[4]),
zone_number=int(map_info[7]),
northern=True if map_info[8] == 'Northern' else False)
return c
示例4: test_to_latlon
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def test_to_latlon(self):
'''to_latlon should give known result with known input'''
for latlon, utm, utm_kw in self.known_values:
result = UTM.to_latlon(*utm)
self.assert_latlon_equal(latlon, result)
result = UTM.to_latlon(*utm[0:3], **utm_kw)
self.assert_latlon_equal(latlon, result)
示例5: convert_utm_lat
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def convert_utm_lat(row):
return utm.to_latlon(row[1], row[2], 11, 'T')[0]
示例6: convert_utm_long
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def convert_utm_long(row):
return utm.to_latlon(row[1], row[2], 11, 'T')[1]
示例7: latlon_rectangle_centered_at
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def latlon_rectangle_centered_at(lat, lon, w, h):
"""
"""
x, y, number, letter = utm.from_latlon(lat, lon)
rectangle = [utm.to_latlon(x - .5*w, y - .5*h, number, letter),
utm.to_latlon(x - .5*w, y + .5*h, number, letter),
utm.to_latlon(x + .5*w, y + .5*h, number, letter),
utm.to_latlon(x + .5*w, y - .5*h, number, letter)]
rectangle.append(rectangle[0]) # close the polygon
return rectangle
示例8: pix_2_latlon
# 需要导入模块: import utm [as 别名]
# 或者: from utm import to_latlon [as 别名]
def pix_2_latlon(gt, px, py, zone_number, northern):
x = px * gt[1] + gt[0]
y = py * gt[5] + gt[3]
if zone_number is not None:
lat, lon = utm.to_latlon(x, y, zone_number, northern=northern)
else:
lat, lon = y, x
return lon, lat, 0