2016-06-13 10 views
0

私は、bing map apiを使用して緯度経度を取得するためにOdoo9のタスクに取り組んでいます。Odoo 9では、base_geolocalizeというモデルがありましたGoogleのAPIの助けによって、緯度/経度取得するための機能がPython/odooでBing Map apiを使用して座標を取得する

def find(addr): 

url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&key=AIzaSyAL-rowwysUmteIHcOXac86AbPiTV1j2zw&address=' 


try: 
    result = json.load(urllib.urlopen(url)) 
except Exception, e: 
    raise UserError(_(
     'Cannot contact geolocation servers. Please make sure that your internet connection is up and running (%s).') % e) 
if result['status'] != 'OK': 
    _logger.info('GEOLOCATION: status not OK' + str(result)) 
    return None 

try: 
    geo = result['results'][0]['geometry']['location'] 
    return float(geo['lat']), float(geo['lng']) 
except (KeyError, ValueError): 
    return None 

私の質問は、次のとおりです。 - 私はビングマップとhow.Pleaseヘルプを使用して同じ結果を得ることができます。おかげ

答えて

関連する問題