libpysal.cg.harcdist¶
-
libpysal.cg.harcdist(p0, p1, lonx=
True, radius=6371.0)[source]¶ Alternative the arc distance function, uses the haversine formula.
- Parameters:¶
- p0 : tuple¶
The first point decimal degrees.
- p1 : tuple¶
The second point decimal degrees.
- lonx : bool¶
The method to assess the order of the coordinates.
Truefor (lon,lat);Falsefor (lat,lon). Default isTrue.- radius : float¶
The radius of a sphere. Default is Earth’s radius in kilometers,
RADIUS_EARTH_KM(6371.0). Earth’s radius in miles,RADIUS_EARTH_MILES(3958.76) is also an option. Set toNonefor radians. Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
- Returns:¶
harc_dist – The distance in units specified, km, miles or radians.
- Return type:¶
harc_dist
Examples
>>> p0 = (-87.893517, 41.981417) >>> p1 = (-87.519295, 41.657498) >>> harcdist(p0, p1) 47.52873002976876>>> harcdist(p0, p1, radius=None) 0.007460167953189258Notes
Uses the
radanglefunction to compute radian angle.