libpysal.cg.harcdist

libpysal.cg.harcdist(p0, p1, lonx=True, radius=6371.0)[source]

Alternative the arc distance function, uses the haversine formula.

Parameters:
p0tuple

The first point decimal degrees.

p1tuple

The second point decimal degrees.

lonxbool

The method to assess the order of the coordinates. True for (lon,lat); False for (lat,lon). Default is True.

radiusfloat

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 to None for radians. Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html

Returns:
harc_distharc_dist

The distance in units specified, km, miles or radians.

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