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.
- lonxbool
The method to assess the order of the coordinates.
True
for (lon,lat);False
for (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 toNone
for radians. Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
- p0
- Returns:
- harc_dist
harc_dist
The distance in units specified, km, miles or radians.
- harc_dist
Notes
Uses the
radangle
function to compute radian angle.Examples
>>> p0 = (-87.893517, 41.981417) >>> p1 = (-87.519295, 41.657498) >>> harcdist(p0, p1) 47.52873002976876
>>> harcdist(p0, p1, radius=None) 0.007460167953189258