当我知道它在陆地上时,为什么底图在陆地上绘制这个纬度和经度?
Why is basemap plotting this latitude and longitude off land when I know it to be on land?
我在澳大利亚新南威尔士州地图的底图中创建了一个散点图,雷达的位置(我知道是 lon=151.2095,lat=-33.7008)被绘制为在海洋实际上是内陆。为什么会这样?
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
def plot_gauges_on_map():
lon_0, lat_0 = 151.2095, -33.7008
width = 1000000
m = Basemap(width=width,height=width,projection='aeqd',
lat_0=lat_0,lon_0=lon_0)
# fill background.
m.drawmapboundary(fill_color='dodgerblue')
# draw coasts and fill continents.
m.drawcoastlines(linewidth=0.5)
m.fillcontinents(color='peru',lake_color='dodgerblue')
# draw a black dot at the radar.
xpt, ypt = m(lon_0, lat_0)
m.plot([xpt],[ypt],'ko')
# draw the title.
plt.title('Terrey Hills Radar')
plt.show()
plot_gauges_on_map()
您没有指定resolution
要使用的地图边界数据库,因此,原始数据库有效。为了在您的案例中获得正确的解决方案,应在 Basemap() 语句中添加选项 resolution="i"
,其中 "i" 代表中间。可能的分辨率是:- c(原始,默认)、l(低)、i、h(高)和 f(完整)。您的情节输出将如下所示。
我在澳大利亚新南威尔士州地图的底图中创建了一个散点图,雷达的位置(我知道是 lon=151.2095,lat=-33.7008)被绘制为在海洋实际上是内陆。为什么会这样?
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
def plot_gauges_on_map():
lon_0, lat_0 = 151.2095, -33.7008
width = 1000000
m = Basemap(width=width,height=width,projection='aeqd',
lat_0=lat_0,lon_0=lon_0)
# fill background.
m.drawmapboundary(fill_color='dodgerblue')
# draw coasts and fill continents.
m.drawcoastlines(linewidth=0.5)
m.fillcontinents(color='peru',lake_color='dodgerblue')
# draw a black dot at the radar.
xpt, ypt = m(lon_0, lat_0)
m.plot([xpt],[ypt],'ko')
# draw the title.
plt.title('Terrey Hills Radar')
plt.show()
plot_gauges_on_map()
您没有指定resolution
要使用的地图边界数据库,因此,原始数据库有效。为了在您的案例中获得正确的解决方案,应在 Basemap() 语句中添加选项 resolution="i"
,其中 "i" 代表中间。可能的分辨率是:- c(原始,默认)、l(低)、i、h(高)和 f(完整)。您的情节输出将如下所示。