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
Google_Place_Nearby_Search.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录