libpysal.cg.harcdist

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

Alternative arc distance function, uses haversine formula

Parameters
p0first point as a tuple in decimal degrees
p1second point as a tuple in decimal degrees
lonxbool to assess the order of the coordinates,

for lon,lat (default) = True, for lat,lon = False

radiusradius of the earth at the equator as a sphere

default: RADIUS_EARTH_KM (6371.0 km) options: RADIUS_EARTH_MILES (3959.0 miles), None (for result in radians)

Returns
ddistance in units specified, km, miles or radians (for None)

Notes

Uses 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