libpysal.cg.arcdist2linear¶
- libpysal.cg.arcdist2linear(arc_dist, radius=6371.0)[source]¶
Convert an arc distance (spherical earth) to a linear distance (R3) in the unit sphere.
- Parameters:
- arc_dist
float
The arc distance to convert.
- 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. Source: http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
- arc_dist
- Returns:
- linear_dist
float
The linear distance conversion of
arc_dist
.
- linear_dist
Examples
>>> pt0 = (0, 0) >>> pt1 = (180, 0) >>> d = arcdist(pt0, pt1, RADIUS_EARTH_MILES) >>> d == math.pi * RADIUS_EARTH_MILES True
>>> arcdist2linear(d, RADIUS_EARTH_MILES) 2.0