今天为大家带来一篇爬取地铁站周边POI数据的教程
调包+把底图画出来:
import osmnx as ox
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import requests
import json
import time
import matplotlib.pyplot as plt
pd.set_option('display.max_columns', None)
pd.set_option('display.max_columns', None)
plt.rcParams['font.sans-serif']=['Arial Unicode MS']
plt.rcParams['axes.unicode_minus']=False
ditie = gpd.read_file('./成都地铁/成都地铁/成都地铁_busstops.shp')
route = gpd.read_file('./成都地铁/成都地铁/成都地铁_buslines.shp')
### 宽窄巷子经纬度 POINT (104.04820 30.66783)
kuanzhai = gpd.GeoDataFrame([Point(104.04820,30.66783)])
kuanzhai.columns = ['geometry']
G = ox.graph_from_point(center_point=(30.66783,104.04820),distance=1000,network_type='drive')
G_gdf = ox.graph_to_gdfs(G)
base = G_gdf[1].plot(figsize=(10,10),edgecolor='