libpysal.cg.harcdist¶
-
libpysal.cg.
harcdist
(p0, p1, lonx=True, radius=6371.0)[source]¶ Alternative arc distance function, uses haversine formula
- Parameters
- p0
first
point
as
a
python:tuple
in
decimal
degrees
- p1
second
point
as
a
python:tuple
in
decimal
degrees
- lonxbool
to
assess
the
order
of
the
coordinates, for lon,lat (default) = True, for lat,lon = False
- radius
radius
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)
- p0
- Returns
- d
distance
in
units
specified
,km
,miles
orradians
(for
python:None
)
- d
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