libpysal.cg.linear2arcdist¶
-
libpysal.cg.linear2arcdist(linear_dist, radius=
6371.0)[source]¶ Convert a linear distance in the unit sphere (R3) to an arc distance based on supplied radius.
- Parameters:¶
- linear_dist : float¶
The linear 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
- Returns:¶
arc_dist – The arc distance conversion of
linear_dist.- Return type:¶
- Raises:¶
ValueError – Raised when
linear_distexceeds the diameter of the unit sphere.
Examples
>>> pt0 = (0, 0) >>> pt1 = (180, 0) >>> d = arcdist(pt0, pt1, RADIUS_EARTH_MILES) >>> d == linear2arcdist(2.0, radius=RADIUS_EARTH_MILES) True