Python批量获取高德地图API POI数据

发现一个高德地图的宝藏功能,极大地方便数据分析师,项目经理,老板们批量获取地图POI数据。

什么是POI?

POI数据是地图上的点类数据,表示一些与人们生活相关的地标建筑和地理实体,通常称作兴趣点,泛指互联网电子地图中的点类数据,基本包含名称、地址、坐标、类别四个属性

譬如说:餐厅,加油站,小区...

图片

批量获取

假设要获取某一地点附近5km内的所有“艺术培训中心”

# -*- coding : utf-8 -*-# @公众号:JavaPython编程之旅# @Time      : 2024/6/7 21:14# @Author    : Leoimport requests
url = "https://restapi.amap.com/v3/place/around?parameters"key = "xxxxxxxxxxx"# 获取坐标 https://lbs.amap.com/tools/pickerlocation = "116.20,39.91"keywords = "艺术培训中心|培训中心"# POI类型types = ""city = 110000radius = 50000# 每页记录数据offset = 25page = 1extensions = "all"params = {    "key": key,    "location": location,    "keywords": keywords,    "city": city,    "radius": radius,    "offset": offset,    "page": page,    "extensions": extensions}response = requests.get(url=url, params=params)print(response.status_code)print(response.json())pois_list = response.json().get("pois")for item in pois_list:    res_dict = {        'keywords': keywords,        'type': item.get('type'),        'adname': item.get('adname'),        'address': item.get('address'),        'name': item.get('name'),        'tel': item.get('tel'),    }    print(res_dict)

结果展示

图片

THE END