python 可视化地图上根据圆心半径标定范围

2 篇文章 1 订阅

pyechart 没有成功，导出百度地图之后无法画圈圈定范围，目前其支持的marker 只有点，线 等四类，是无法画圆的。在百度地图上JS里marker有画圆的工具，所以理论上是可以实现的，奈何没学过JavaScript，故放弃。

geopandas实现过程：


%matplotlib  inline
import numpy as np,pandas as pd,matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from  geopy.distance import great_circle
from shapely.geometry  import MultiPoint,Polygon
from geopy.geocoders  import Nominatim
import geopandas as gpd
from sklearn.preprocessing  import StandardScaler,minmax_scale
from shapely.geometry import Point
import seaborn as sns
sns.set()

fig, ax = plt.subplots(figsize=(21,21))
ax.set_aspect('equal')
cs_ploy = data['geometry']
cs_ploy.plot(ax=ax, color='w', edgecolor='black',alpha = 0.1)
plt.scatter(120.672111,28.000575,s=50,alpha = 0.8,color = 'b',marker = "o",label='POS')
circle = plt.Circle((120.672111,28.000575), 50/111, color='green', fill=False)

plt.show()


data2= gpd.read_file(‘温州市.json')
fig, ax = plt.subplots(figsize=(21,21))
ax.set_aspect('equal')
cs_ploy = data2['geometry']
#坐标参考系转换为米
cs_ploy = cs_ploy.to_crs('epsg:3395')
cs_ploy.plot(ax=ax, color='w', edgecolor='black',alpha = 0.1)

geo_point1 = gpd.GeoSeries([Point(120.672111,28.000575)])
#坐标参考系先设置为经纬度再转换为米
geo_point1.crs = {'init' :'epsg:4326'}
geo_point1 = geo_point1.to_crs('+init=epsg:3395')
geo_point1.plot(ax=ax, marker='D', c='#99cc99', edgecolor='None', alpha=0.7, markersize=20)
geo_point1.buffer(50000).plot(ax=ax,alpha = 0.2)

plt.show()



folium实现过程:

import json
import requests
import folium
import webbrowser

with open('温州市.json',encoding='UTF-8') as f:

wz_map = folium.Map(location=[27.791883,120.557161], zoom_start=7)
folium.GeoJson(
wz_states,
style_function=lambda feature: {
'fillColor': '#ffff00',
'color': 'black',
'weight': 2,
'dashArray': '5, 5'
}

folium.Circle(
location=[27.791883,120.557161],
popup='The Waterfront',
color='crimson',
fill=False,

wz_map.save('wz_map.html')



• 7
点赞
• 28
收藏
觉得还不错? 一键收藏
• 1
评论
04-01 2万+
06-30 8701
09-17
01-16 3788
04-06 1360
04-25 1296
05-11
12-25 601

“相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。