Exemple #1
0
def get_image_location_name(filename):
    country = None
    city = None

    with open(filename, 'rb') as file:
        data = exifread.process_file(file)
        if data:
            #logger.debug("data {}".format(data))
            (lat, lon) = get_exif_location(data)
            logger.debug("lat={}, lon={}".format(lat, lon))
            if lat and lon:
                geolocator = Bing(
                    "Anoh-j0qAKYh64FthGAOOFjyXExe3uf5D1L2qtPAEenOMna-IYXVH_0khZNQlHJH"
                )
                location = geolocator.reverse(Point(lat, lon), True, 20)
                logger.info(location.address)
        else:
            logger.debug("no EXIF in file {}".format(filename))

    return country, city
#place = geo.baidu(g.latlng,method='reverse',key='DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO')



from geopy.geocoders import Baidu,Bing 

geoBaidu = Baidu(r'DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO')
location = geoBaidu.geocode("中国人民大学")
place= geoBaidu.reverse((location.latitude,location.longitude))




geoBing = Bing('AtIY2sEa0AgKcn-9HXv7_kHyj29hepj0Ko4Pb4xZvoSUXN_ZXesx1z42EAIbDENL')
location = geoBing.geocode("中国人民大学")
place= geoBing.reverse((location.latitude,location.longitude),exactly_one=False)





'''
百度 API 直接开发 地理位置坐标转换
1.构建查询字符串  http://api.map.baidu.com/geocoder/v2/
2.查询gis 坐标
3.利用gis 坐标 reverse 查询附近地理位置  http://api.map.baidu.com/geosearch/v3/nearby/ 

baidu api key  DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO 终于好了,我去!
'''
import pandas as pd
import numpy as np
    key='AtIY2sEa0AgKcn-9HXv7_kHyj29hepj0Ko4Pb4xZvoSUXN_ZXesx1z42EAIbDENL')

# baidu
g = geo.baidu('中国人民大学', key='DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO')
#place = geo.baidu(g.latlng,method='reverse',key='DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO')

from geopy.geocoders import Baidu, Bing

geoBaidu = Baidu(r'DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO')
location = geoBaidu.geocode("中国人民大学")
place = geoBaidu.reverse((location.latitude, location.longitude))

geoBing = Bing(
    'AtIY2sEa0AgKcn-9HXv7_kHyj29hepj0Ko4Pb4xZvoSUXN_ZXesx1z42EAIbDENL')
location = geoBing.geocode("中国人民大学")
place = geoBing.reverse((location.latitude, location.longitude),
                        exactly_one=False)
'''
百度 API 直接开发 地理位置坐标转换
1.构建查询字符串  http://api.map.baidu.com/geocoder/v2/
2.查询gis 坐标
3.利用gis 坐标 reverse 查询附近地理位置  http://api.map.baidu.com/geosearch/v3/nearby/ 

baidu api key  DPlowD7PIEfaVtpxLKGkXg8yDCCBanVO 终于好了,我去!
'''
import pandas as pd
import numpy as np

import requests
from urllib.parse import *
import math
import re