资源简介
此为Python包,利用百度地图API实现指定经纬度,返回相应的省市区等位置信息。

代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Mon Aug 6 11:57:57 2018
@author: Leon
根据百度地图API,获取给定经纬度的地点所在省市区信息
我所申请的百度AK(未做IP限制):YRGGPTIunajhbD9EPevI7i8ZCWWekEDs
“““
import requests as _req
class location:
def __init__(selflnglatak=‘YRGGPTIunajhbD9EPevI7i8ZCWWekEDs‘):
# 初始化变量,并通过在变量名前面加双下划线“__”,来使其成为私有变量,防止类外访问
self.__lng=lng
self.__lat=lat
self.__ak=ak
items = {‘location‘: str(self.__lat) + ‘‘ + str(self.__lng) ‘ak‘: self.__ak ‘output‘: ‘json‘}
res = _req.get(‘http://api.map.baidu.com/geocoder/v2/‘ params=items)
self.__result = res.json()
def country(self):
return self.__result[‘result‘][‘addressComponent‘][‘country‘]
def province(self):
return self.__result[‘result‘][‘addressComponent‘][‘province‘]
def city(self):
return self.__result[‘result‘][‘addressComponent‘][‘city‘]
def district(self):
return self.__result[‘result‘][‘addressComponent‘][‘district‘]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 0 2018-08-10 10:20 baidumapAPI\__init__.py
目录 0 2018-08-24 10:21 baidumapAPI\__pycache__\
文件 163 2018-08-10 10:59 baidumapAPI\__pycache__\__init__.cpython-36.pyc
文件 1595 2018-08-10 10:59 baidumapAPI\__pycache__\locatebyLatLng.cpython-36.pyc
文件 1202 2018-08-10 10:48 baidumapAPI\locatebyLatLng.py
目录 0 2018-08-24 10:21 baidumapAPI\
- 上一篇:python实现图书借阅系统
- 下一篇:python开发用到的工具书籍一套全
相关资源
- python 语音提示( 基于SAPI.SPVOICE)
- 调用百度API实现翻译器,能够翻译多
- 动物图片识别.py(基于百度api)
- 企业微信api接口实现
- 图像分割-snake算法 python版本
- Python-使用DeepFakes实现YouTube视频自动换
- Python,通过Googlemap API获取地点信息
- Morphological Snakes——改进版Geodestic a
- dlib18.17 编译好的python-dlib库 不需要
- 【官方文档】TensorFlow Python API docume
- 高德API + Python 解决租房问题_实验楼
- python3.6 API
- SHA-3 哈希摘要算法 python 源代码及官方
- sha3 python 史上最全最详细的正确实现
- 《Rapid GUI Programming with Python and Qt》
- Make Your Own Neural Network - 搭建自己的神
- 3ds Max Python API
- Python标准库查询手册最新Python 3.3
- Web Scraping with Python_Collecting Data from
- Packt-Web.Scraping.with.Python.Richard Lawson
- Python语言开发RESTful API指南
- CherryPy Essentials - Rapid Python Web Applica
- 百分百汉化Python2与Python3的中文版AP
- Blender Python API
- Python3.8.0 官方中文帮助文档 API参考手
- 百度地图数据采集器.zip
- 基于scrapy框架的百度地图公交站点数
- wxPython4.0 api && doc
- Python数据科学手册[美]杰克·万托布拉
- python爬取摩拜单车API数据并做可视化
评论
共有 条评论