使用 Python 在地图上表示扇形图像
Representing a Fan Shaped Image on a Map using Python
我希望使用下面的 table 作为输入在地图上显示一个对象(扇形对象,每条突出线位于垂直 'ID Angle' 处):
Table(输入):
扇形物体:
我可以使用 python 在地图上显示一个点(非常简单)。到目前为止,我的问题是想出一种方法来根据上述对象表示每条突出线。
如有任何帮助,我将不胜感激。
更新
请看下面:
import matplotlib.pyplot as plt
longitude = [4.3323, 4.3323, 4.3323]
latitude = [2.3433, 2.3433, 2.3433]
x,y = map(longitude, latitude)
map.plot(x, y, 'bo', markersize=18)
plt.show()
所以基本上我已经能够用一个点来表示这些数据点了。
我需要整合我之前所说的定向改进。
试试这个:
import numpy as np
import matplotlib.pyplot as plt
center = (4.3323, 2.3433)
angles = [60, 120, 240]
angles = [a/180.0*np.pi for a in angles]
# scale
l = 1
# the center point
x, y = center
# draw each line
for a in angles:
dx = l * np.sin(a)
dy = l * np.cos(a)
plt.plot([x, x + dx], [y, y + dy], 'k-')
# draw the center circle
plt.plot(x, y, 'wo', ms=l*100)
plt.show()
我希望使用下面的 table 作为输入在地图上显示一个对象(扇形对象,每条突出线位于垂直 'ID Angle' 处):
Table(输入):
扇形物体:
我可以使用 python 在地图上显示一个点(非常简单)。到目前为止,我的问题是想出一种方法来根据上述对象表示每条突出线。
如有任何帮助,我将不胜感激。
更新
请看下面:
import matplotlib.pyplot as plt
longitude = [4.3323, 4.3323, 4.3323]
latitude = [2.3433, 2.3433, 2.3433]
x,y = map(longitude, latitude)
map.plot(x, y, 'bo', markersize=18)
plt.show()
所以基本上我已经能够用一个点来表示这些数据点了。
我需要整合我之前所说的定向改进。
试试这个:
import numpy as np
import matplotlib.pyplot as plt
center = (4.3323, 2.3433)
angles = [60, 120, 240]
angles = [a/180.0*np.pi for a in angles]
# scale
l = 1
# the center point
x, y = center
# draw each line
for a in angles:
dx = l * np.sin(a)
dy = l * np.cos(a)
plt.plot([x, x + dx], [y, y + dy], 'k-')
# draw the center circle
plt.plot(x, y, 'wo', ms=l*100)
plt.show()