Python:如何在地图上绘制飞行轨迹/例行程序
我正试图用位置数据在地图上绘制飞行路线图 我得到了一份包括其他信息的职位数据。部分数据附于下文。第五列和第六列分别为lat和lonPython:如何在地图上绘制飞行轨迹/例行程序,python,matplotlib,matplotlib-basemap,flightpath,Python,Matplotlib,Matplotlib Basemap,Flightpath,我正试图用位置数据在地图上绘制飞行路线图 我得到了一份包括其他信息的职位数据。部分数据附于下文。第五列和第六列分别为lat和lon 0 C130 30-07-2018 20:07 43.53 -116.16 887.60 887.598 1 C130 30-07-2018 20:08 43.49 -116.17 860.73 860.733 2 C130 30-07-2018 20:09 43.45 -116.23 832.14 832
0 C130 30-07-2018 20:07 43.53 -116.16 887.60 887.598
1 C130 30-07-2018 20:08 43.49 -116.17 860.73 860.733
2 C130 30-07-2018 20:09 43.45 -116.23 832.14 832.143
3 C130 30-07-2018 20:10 43.42 -116.29 798.53 798.529
4 C130 30-07-2018 20:11 43.39 -116.36 769.36 769.359
5 C130 30-07-2018 20:12 43.38 -116.44 744.33 744.332
6 C130 30-07-2018 20:13 43.37 -116.52 713.75 713.749
7 C130 30-07-2018 20:14 43.37 -116.60 682.41 682.406
8 C130 30-07-2018 20:15 43.38 -116.68 658.94 658.943
9 C130 30-07-2018 20:16 43.40 -116.76 634.47 634.471
10 C130 30-07-2018 20:17 43.39 -116.83 611.09 611.085
11 C130 30-07-2018 20:18 43.34 -116.86 591.79 591.791
12 C130 30-07-2018 20:19 43.28 -116.88 572.06 572.057
13 C130 30-07-2018 20:20 43.23 -116.90 554.59 554.594
14 C130 30-07-2018 20:21 43.16 -116.92 551.53 551.532
15 C130 30-07-2018 20:22 43.11 -116.98 551.75 551.745
16 C130 30-07-2018 20:23 43.07 -117.05 551.64 551.641
17 C130 30-07-2018 20:24 43.03 -117.12 551.55 551.545
18 C130 30-07-2018 20:25 42.98 -117.19 551.49 551.486
19 C130 30-07-2018 20:26 42.94 -117.27 551.45 551.448
所以在我处理完数据之后。我得到了位置信息。并获得如下所示的原始数据。第一列是lat,第二列是lon
[[ 43.53 -116.16]
[ 43.49 -116.17]
[ 43.45 -116.23]
[ 43.42 -116.29]
[ 43.39 -116.36]
[ 43.38 -116.44]
[ 43.37 -116.52]
[ 43.37 -116.6 ]
[ 43.38 -116.68]
[ 43.4 -116.76]
...]
我有这样的例行公事
但我想用cartopy在地球物理图上绘制它
但是我想不出来
你能给我一些建议吗
Lixu您可以查看Cartopy文档,有许多简单的示例可用于构建您自己的地图,我建议您从头开始。 为了绘制数据,我创建了以下示例:
import cartopy.crs as ccrs
import cartopy.feature as cfeature
#Create latitude and longitude data
lat=np.array([43.53,43.49,43.45,43.42,43.39,43.38,43.37,43.37,43.38,43.4])
lon=np.array([-116.16,-116.17,-116.23,-116.29,-116.36,-116.44,-116.52,-116.6,-116.68,-116.76])
#define map extent
extent = [-130, -90, 30, 60]
#define state borders
states_borders = cfeature.NaturalEarthFeature(
category='cultural',
name='admin_0_countries',
scale='50m',
facecolor='none')
states_provinces = cfeature.NaturalEarthFeature(
category='cultural',
name='admin_1_states_provinces_lines',
scale='50m',
facecolor='none')
#create figure
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
#Add features
ax.add_feature(cfeature.LAND)
ax.add_feature(states_provinces, edgecolor='gray')
ax.add_feature(states_borders, edgecolor='black')
#plot data
ax.plot(lon,lat, 'o',transform=ccrs.PlateCarree())
ax.set_extent(extent)
plt.show()
将生成以下图像:
如果要添加图层并生成更复杂的贴图,可以开始在此基础上进行构建