【Python】使用geopy由地址找经纬度等信息
代码:
from geopy.geocoders import Nominatim
geolocator = Nominatim()
location = geolocator.geocode("大连火车站") # 还得是有名地方。名气小的地方这个API会罢工
print(location.address)
print((location.latitude, location.longitude))
print(location.raw)
输出:
大连火车站, 长江路, 西岗区, 大连市, 甘井子区 / Ganjingzi, 大连市 / Dalian, 辽宁省, 116011, 中国
(38.9199585, 121.6298679)
{', 'boundingbox': ['38.9199085', '38.9200085', '121.6298179', '121.6299179'], 'lat': '38.9199585', 'lon': '121.6298679', 'display_name': '大连火车站, 长江路, 西岗区, 大连市, 甘井子区 / Ganjingzi, 大连市 / Dalian, 辽宁省, 116011, 中国', 'class': 'railway', 'type': 'tram_stop', 'importance': 0.11025, 'icon': 'https://nominatim.openstreetmap.org/images/mapicons/transport_tram_stop.p.20.png'}
另:北京天安门的是
C:\Users\horn1\Desktop\python\50-geopy>python findaddress.py
天安门, 1, 西长安街, 崇文, 北京市, 东城区, 北京市, 100010, 中国
(39.90733345, 116.391244079988)
{', 'boundingbox': ['39.9072273', '39.9075343', '116.3906566', '116.3918428'], 'lat': '39.90733345', 'lon': '116.391244079988', 'display_name': '天安门, 1, 西长安街, 崇文, 北京市, 东城区, 北京市, 100010, 中国', 'class': 'building', 'type': 'yes', 'importance': 0.00025}
2018年5月15日
【Python】使用geopy由地址找经纬度等信息的更多相关文章
- 高德地图api实现地址和经纬度的转换(python)
利用高德地图web服务api实现地理/逆地址编码 api使用具体方法请查看官方文档 文档网址:http://lbs.amap.com/api/webservice/guide/api/georegeo ...
- 个人永久性免费-Excel催化剂功能第92波-地理地址与经纬度互转功能
GPS设备和手机LBS的兴起,在地理信息存储过程中,在程序.应用级别是需要用经纬度去定位,而在数据分析的级别,特别是省市区镇街的分析,用到的是人可识别的文本类型存储,从设备中采集下来的数据和人工维护的 ...
- 基于python实现查询ip地址来源
接口调用方法是在url后面直接加上IP地址. url = 'http://freeapi.ipip.net/218.192.3.42' #中文免费 url2 = 'http://ip-api.com/ ...
- Python 获取 网卡 MAC 地址
/*********************************************************************** * Python 获取 网卡 MAC 地址 * 说明: ...
- 根据地址查询经纬度.html
<html xmlns="http://www.w3.org/1999/xhtml"><head> <title>根据地址查询经纬度</t ...
- 通过崩溃地址找错误行数之Delphi版
通过崩溃地址找错误行数之Delphi版2009-5-11 17:42:35 来源: 转载 作者:网络 访问:360 次 被顶:2 次 字号:[大 中 小]核心提示:什么是 MAP 文件?简单地讲, M ...
- 通过地址获得经纬度(百度Geocoding API)
1.什么是Geocoding? Geocoding API 是一类简单的HTTP接口,用于提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务,用户可以使用C# .C++.Java等开发语言发送HT ...
- python整数与IP地址转换
python整数与IP地址转换 [转] 我们有时会将一个整数与IP地址进行互换,用python代码实现很简单将一个整数如2000000,变为一个IP地址的方式 >>> import ...
- 根据地址查询经纬度Js
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>根据地址查询经纬度</ ...
随机推荐
- 百度地图api---实现新建地图
调用这个函数 function refresh() { history.go(0); } 实现了地图新建
- ADO.NET理论+实践
题记: 每一事物的产生和存在都有其特定的理由. 理论:ADO.NET是一组与数据源进行交互的面向对象类库.通常情况下数据源就是数据库,当然同样也能是文本文件,Excel表格或XML文件,我们知道的数 ...
- Revit API风管对齐
start [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] ].Origin, list ...
- AngularJS一个由于未声明对象而报的错
实现这样的一个需求:点击某个按钮,然后显示或隐藏某块区域. 先注册一个AngularJS的一个module: var myApp = angular.module("myApp", ...
- EBS已安装模块
/* Formatted on 2018/3/15 11:14:51 (QP5 v5.256.13226.35538) */ SELECT fa.application_short_name , fp ...
- pio 背景色
This example shows you Excel cell fills and colors using Apache POI. In our example i have used all ...
- java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method 解决办法
java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an in ...
- Universal-Image-Loader解析(一)——ImageLoaderConfiguration的详细配置
Universal-Image-Loader这个开源框架又来给我们造福了,它是一个图片加载框架,主要强大在于可以用于网络等图片源的加载,并且有多重缓存机制.先给出其项目地址:https://githu ...
- Java之旅--定时任务(Timer、Quartz、Spring、LinuxCron)
在Java中,实现定时任务有多种方式,本文介绍4种,Timer和TimerTask.Spring.QuartZ.Linux Cron. 以上4种实现定时任务的方式,Timer是最简单的,不需要任何框架 ...
- Emulator: glTexImage2D: got err pre :( 0x502 internal 0x1908 format 0x1908 type 0x1401
Go to Tools > AVD Manager > Virtual device configuration > Show advanced settings > Boot ...