格奥德

pyproj.Geod

class pyproj.Geod(initstring=None, **kwargs)[源代码]

基类:pyproj._geod.Geod

进行正反大地测量或大圆计算。前向计算(使用“fwd”方法)涉及确定计算的纬度、经度和后方位角。前向计算(使用“fwd”方法)涉及确定一个终点的纬度、经度和后方位角,给定一个起点的纬度和经度,再加上方位角和距离。逆计算(使用“inv”方法)涉及确定给定初始点和终点的纬度和经度的前后方位角和距离。

__init__(initstring=None, **kwargs)[源代码]

初始化geod类实例。

用于指定椭球体的大地测量参数可以在字典“initparams”中作为关键字参数或作为proj4 geod初始化字符串提供。以下是可以使用“ellps”关键字定义的椭球体列表(这些椭球体存储在模型变量pj_ellps中)::

MERIT a=6378137.0      rf=298.257       MERIT 1983
SGS85 a=6378136.0      rf=298.257       Soviet Geodetic System 85
GRS80 a=6378137.0      rf=298.257222101 GRS 1980(IUGG, 1980)
IAU76 a=6378140.0      rf=298.257       IAU 1976
airy a=6377563.396     b=6356256.910    Airy 1830
APL4.9 a=6378137.0.    rf=298.25        Appl. Physics. 1965
airy a=6377563.396     b=6356256.910    Airy 1830
APL4.9 a=6378137.0.    rf=298.25        Appl. Physics. 1965
NWL9D a=6378145.0.     rf=298.25        Naval Weapons Lab., 1965
mod_airy a=6377340.189 b=6356034.446    Modified Airy
andrae a=6377104.43    rf=300.0         Andrae 1876 (Den., Iclnd.)
aust_SA a=6378160.0    rf=298.25        Australian Natl & S. Amer. 1969
GRS67 a=6378160.0      rf=298.247167427 GRS 67(IUGG 1967)
bessel a=6377397.155   rf=299.1528128   Bessel 1841
bess_nam a=6377483.865 rf=299.1528128   Bessel 1841 (Namibia)
clrk66 a=6378206.4     b=6356583.8      Clarke 1866
clrk80 a=6378249.145   rf=293.4663      Clarke 1880 mod.
CPM a=6375738.7        rf=334.29        Comm. des Poids et Mesures 1799
delmbr a=6376428.      rf=311.5         Delambre 1810 (Belgium)
engelis a=6378136.05   rf=298.2566      Engelis 1985
evrst30 a=6377276.345  rf=300.8017      Everest 1830
evrst48 a=6377304.063  rf=300.8017      Everest 1948
evrst56 a=6377301.243  rf=300.8017      Everest 1956
evrst69 a=6377295.664  rf=300.8017      Everest 1969
evrstSS a=6377298.556  rf=300.8017      Everest (Sabah & Sarawak)
fschr60 a=6378166.     rf=298.3         Fischer (Mercury Datum) 1960
fschr60m a=6378155.    rf=298.3         Modified Fischer 1960
fschr68 a=6378150.     rf=298.3         Fischer 1968
helmert a=6378200.     rf=298.3         Helmert 1906
hough a=6378270.0      rf=297.          Hough
helmert a=6378200.     rf=298.3         Helmert 1906
hough a=6378270.0      rf=297.          Hough
intl a=6378388.0       rf=297.          International 1909 (Hayford)
krass a=6378245.0      rf=298.3         Krassovsky, 1942
kaula a=6378163.       rf=298.24        Kaula 1961
lerch a=6378139.       rf=298.257       Lerch 1979
mprts a=6397300.       rf=191.          Maupertius 1738
new_intl a=6378157.5   b=6356772.2      New International 1967
plessis a=6376523.     b=6355863.       Plessis 1817 (France)
SEasia a=6378155.0     b=6356773.3205   Southeast Asia
walbeck a=6376896.0    b=6355834.8467   Walbeck
WGS60 a=6378165.0      rf=298.3         WGS 60
WGS66 a=6378145.0      rf=298.25        WGS 66
WGS72 a=6378135.0      rf=298.26        WGS 72
WGS84 a=6378137.0      rf=298.257223563 WGS 84
sphere a=6370997.0     b=6370997.0      Normal Sphere (r=6370997)

椭球体的参数也可以直接使用“A”(半长轴或赤道轴半径)关键字和以下任何关键字设置:“B”(半短轴或极轴半径)、“E”(偏心率)、“ES”(偏心率平方)、“F”(平展)或“RF”(倒数平展)。

请参阅proj文档(https://github.com/osgeo/proj.4/wiki),了解有关指定椭球体参数的更多信息(具体来说,请参阅proj主用户手册中的“指定地球图形”一章)。

示例用法:

>>> from pyproj import Geod
>>> g = Geod(ellps='clrk66') # Use Clarke 1866 ellipsoid.
>>> # specify the lat/lons of some cities.
>>> boston_lat = 42.+(15./60.); boston_lon = -71.-(7./60.)
>>> portland_lat = 45.+(31./60.); portland_lon = -123.-(41./60.)
>>> newyork_lat = 40.+(47./60.); newyork_lon = -73.-(58./60.)
>>> london_lat = 51.+(32./60.); london_lon = -(5./60.)
>>> # compute forward and back azimuths, plus distance
>>> # between Boston and Portland.
>>> az12,az21,dist = g.inv(boston_lon,boston_lat,portland_lon,portland_lat)
>>> "%7.3f %6.3f %12.3f" % (az12,az21,dist)
'-66.531 75.654  4164192.708'
>>> # compute latitude, longitude and back azimuth of Portland,
>>> # given Boston lat/lon, forward azimuth and distance to Portland.
>>> endlon, endlat, backaz = g.fwd(boston_lon, boston_lat, az12, dist)
>>> "%6.3f  %6.3f %13.3f" % (endlat,endlon,backaz)
'45.517  -123.683        75.654'
>>> # compute the azimuths, distances from New York to several
>>> # cities (pass a list)
>>> lons1 = 3*[newyork_lon]; lats1 = 3*[newyork_lat]
>>> lons2 = [boston_lon, portland_lon, london_lon]
>>> lats2 = [boston_lat, portland_lat, london_lat]
>>> az12,az21,dist = g.inv(lons1,lats1,lons2,lats2)
>>> for faz,baz,d in list(zip(az12,az21,dist)): "%7.3f %7.3f %9.3f" % (faz,baz,d)
' 54.663 -123.448 288303.720'
'-65.463  79.342 4013037.318'
' 51.254 -71.576 5579916.651'
>>> g2 = Geod('+ellps=clrk66') # use proj4 style initialization string
>>> az12,az21,dist = g2.inv(boston_lon,boston_lat,portland_lon,portland_lat)
>>> "%7.3f %6.3f %12.3f" % (az12,az21,dist)
'-66.531 75.654  4164192.708'
fwd(lons, lats, az, dist, radians=False)[源代码]

正向转换-返回给定初始点的经度(lons)和纬度(lats)以及正向方位角(az)和距离(dist)的端点的经度、纬度和后方位角。初始点的纬度(lats),加上前方位角(az)和距离(dist)。

使用numpy和常规的python数组对象、python序列和scalar。

如果弧度=真,则lons/lats和方位角是弧度而不是度数。距离以米为单位。

inv(lons1, lats1, lons2, lats2, radians=False)[源代码]

逆变换-返回前向和后向方位角,以及初始点(由lons1、lats1指定)和终点(由lons2、lats2指定)之间的距离。

使用numpy和常规的python数组对象、python序列和scalar。

如果弧度=真,则lons/lats和方位角是弧度而不是度数。距离以米为单位。

npts(lon1, lat1, lon2, lat2, npts, radians=False)[源代码]

给定一个初始点和终点(由python floats lon1、lat1和lon2、lat2指定),返回一个经度/纬度对列表,描述初始点和终点之间沿测地线的NPT等间距中间点。

如果弧度=真,则lons/lats是弧度而不是度数。

示例用法:

>>> from pyproj import Geod
>>> g = Geod(ellps='clrk66') # Use Clarke 1866 ellipsoid.
>>> # specify the lat/lons of Boston and Portland.
>>> boston_lat = 42.+(15./60.); boston_lon = -71.-(7./60.)
>>> portland_lat = 45.+(31./60.); portland_lon = -123.-(41./60.)
>>> # find ten equally spaced points between Boston and Portland.
>>> lonlats = g.npts(boston_lon,boston_lat,portland_lon,portland_lat,10)
>>> for lon,lat in lonlats: '%6.3f  %7.3f' % (lat, lon)
'43.528  -75.414'
'44.637  -79.883'
'45.565  -84.512'
'46.299  -89.279'
'46.830  -94.156'
'47.149  -99.112'
'47.251  -104.106'
'47.136  -109.100'
'46.805  -114.051'
'46.262  -118.924'
>>> # test with radians=True (inputs/outputs in radians, not degrees)
>>> import math
>>> dg2rad = math.radians(1.)
>>> rad2dg = math.degrees(1.)
>>> lonlats = g.npts(dg2rad*boston_lon,dg2rad*boston_lat,dg2rad*portland_lon,dg2rad*portland_lat,10,radians=True)
>>> for lon,lat in lonlats: '%6.3f  %7.3f' % (rad2dg*lat, rad2dg*lon)
'43.528  -75.414'
'44.637  -79.883'
'45.565  -84.512'
'46.299  -89.279'
'46.830  -94.156'
'47.149  -99.112'
'47.251  -104.106'
'47.136  -109.100'
'46.805  -114.051'
'46.262  -118.924'