[英]How to convert a GeoSeries of points to a list of tuples (lat, lon) using GeoPandas
[英]How to plot a some circle with LAT LON and Radius in Geopandas/Matplotlib?
我是 Geopandas 的新手。 如何在 map 上画一个圆圈? 我想定义 LAT/LON 和半径,然后在 map 上绘制它。
这就是我要的:
这是代码:
import matplotlib.pyplot as plt
import geopandas
plt.rcParams["font.family"] = "Times New Roman"
states = geopandas.read_file('data/usa-states-census-2014.shp')
type(states)
states.crs
states = states.to_crs("EPSG:3395")
states.boundary.plot(figsize=(18, 12), color="Black")
plt.show()
我如何 plot 基于纬度/经度和半径的圆圈?
幸运的是,投影“EPSG:3395”是保角投影。 要在等角投影上绘制(投影)圆,请使用 cartopy 的geoaxes
可用的.tissot()
方法。 这是演示重要步骤的部分代码:
ax2 = plt.subplot(111, projection=ccrs.epsg(3395)) #"EPSG:3395"
# usa_main is a geoDataFrame with crs="EPSG:3395"
usa_main.plot(column="sclass", legend=False,
cmap=matplotlib.cm.Reds,
ec=edgecolor, lw=0.4,
alpha=0.5,
ax=ax2)
# plot circle at 2 locations with different radii
ax2.tissot(rad_km=300, lons=[-95.4,], lats=[29.7,], n_samples=36, zorder=10)
ax2.tissot(rad_km=500, lons=[-81.3,], lats=[28.5,], n_samples=36, zorder=10)
ax2.gridlines(crs=ccrs.PlateCarree(), draw_labels=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.