Google_Place_Nearby_Search.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Hanhan_Play_With_Social_Media 作者: hanhanwu 项目源码 文件源码
def calculate_distance(merchant_loc, user_loc):
  geolocator = Nominatim()

  merchant_lat_lng = [Decimal(l) for l in merchant_loc.split(',')]
  al1 = (merchant_lat_lng[0], merchant_lat_lng[1])

  location2 = geolocator.geocode(user_loc)
  if location2 == None: return None
  al2 = (location2.latitude, location2.longitude)

  distce = vincenty(al1, al2).miles
  return distce
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号