通过Google API获得位置的经纬度
2018-03-14 19:31
357 查看
通过Google API获得位置的经纬度
KEY需要在google获取。import json from urllib.parse import quote from urllib.request import urlopen KEY = 'AIzaSyA0P56jBuEQRbe2IUnzBfmnK_beo2aYln8' def get_address(address, key): url = 'https://maps.googleapis.com/maps/api/geocode/json?' + 'address=' + address + '&key=' + key # 中文url需要转码才能识别 # url = quote(url, ':?=/') print(url) response = urlopen(url).read().decode('utf-8') # response is str response_json = json.loads(response) # response_json is dict print(response_json) lat = response_json.get('results')[0]['geometry']['location']['lat'] lng = response_json.get('results')[0]['geometry']['location']['lng'] print(address + '的经纬度是: %f, %f' % (lat, lng)) return lat, lng
相关文章推荐
- Android通过原生APi获取所在位置的经纬度
- 获取移动手機基站ID并通过google API获取经纬度等参数
- 在ios中使用手机定位获得的经纬度坐标 通过 arcgis的api 显示在wgs84 坐标系的地图上。
- 借助百度api通过经纬度查询位置信息
- iOS 开发 如何获得用户当前位置(通过经纬度获得城市、省份等信息)
- 通过地址获得经纬度(百度Geocoding API)
- 通过GOOGLE 的接口获得经纬度来定位
- Android通过原生APi获取所在位置的经纬度
- HTML5获取地理经纬度并通过百度接口得到实时位置
- 根据百度API获得经纬度,然后根据经纬度在获得城市信息
- 通过Google获得免费天气预报的方法
- 根据经纬度调用Google地图显示对应位置
- java程序调用百度Geocoding API逆地址解析通过经纬度查询位置
- Google Directions API通过请求获取导航数据简介
- ASP.NET MVC通过OAuth调用Google API获取用户信息
- iOS-81-百度地图-通过经纬度获取到具体位置
- iOS上地图通过地理位置经纬度找出城市等信息
- 谷歌地图应用之如何从谷歌地图获得当前位置的经纬度信息
- Windows Azure真实案例:Glympse 位置分享解决方案提供商通过托管服务获得了生产力和敏捷性
- 通过google weather api获得天气xml信息并用DOMDocument将其转换为数组(实例)