当前位置:   article > 正文

python怎么找资源_新手Python学习资源哪里找好呢 视频?

python编程找资源

光看视频是不够的,还得动手,这样你的水平才能提高

关于资源,一定得找系统的,而且还得有很多的实战例子

这样你才能够提高自己的动手能力

资料的话,我这里积累了很多这方面的干货

有需要的可以参考下图找我交流

def haversine_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> float:

"""

Calculate great circle distance between two points in a sphere,

We know that the globe is "sort of" spherical, so a path between two points

isn't exactly a straight line. We need to account for the Earth's curvature

when calculating distance from point A to B. This effect is negligible for

small distances but adds up as distance increases. The Haversine method treats

the earth as a sphere which allows us to "project" the two points A and B

onto the surface of that sphere and approximate the spherical distance between

them. Since the Earth is not a perfect sphere, other methods which model the

Earth's ellipsoidal nature are more accurate but a quick and modifiable

computation like Haversine can be handy for shorter range distances.

Args:

lat1, lon1: latitude and longitude of coordinate 1

lat2, lon2: latitude and longitude of coordinate 2

Returns:

geographical distance between two points in metres

>>> from collections import namedtuple

>>> point_2d = namedtuple("point_2d", "lat lon")

>>> SAN_FRANCISCO = point_2d(37.774856, -122.424227)

>>> YOSEMITE = point_2d(37.864742, -119.537521)

>>> f"{haversine_distance(*SAN_FRANCISCO, *YOSEMITE):0,.0f} meters"

'254,352 meters'

"""

# Distance in metres(m)

AXIS_A = 6378137.0

AXIS_B = 6356752.314245

RADIUS = 6378137

# Equation parameters

flattening = (AXIS_A - AXIS_B) / AXIS_A

phi_1 = atan((1 - flattening) * tan(radians(lat1)))

phi_2 = atan((1 - flattening) * tan(radians(lat2)))

lambda_1 = radians(lon1)

lambda_2 = radians(lon2)

# Equation

sin_sq_phi = sin((phi_2 - phi_1) / 2)

sin_sq_lambda = sin((lambda_2 - lambda_1) / 2)

# Square both values

sin_sq_phi *= sin_sq_phi

sin_sq_lambda *= sin_sq_lambda

h_value = sqrt(sin_sq_phi + (cos(phi_1) * cos(phi_2) * sin_sq_lambda))

return 2 * RADIUS * asin(h_value)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/902945
推荐阅读
相关标签
  

闽ICP备14008679号