底图投影

时间:2015-06-20 10:35:15

标签: matplotlib-basemap

我有以下格式的纬度和经度数据      11.422,47.3156

我想在底图上绘制这些点,但我不知道使用哪个投影来正确绘制它们。尝试了一些,但没有成功,请帮助我。

2 个答案:

答案 0 :(得分:1)

您使用的投影取决于您对地图的目的。下面是一个使用lat / lon和常见的Transverse Mercator投影的简单示例:

#!/bin/env python3
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

# set map boundaries
south, north = 3, 20
west, east = 38, 56
center = [(east+west)/2, (north+south)/2]

# define basemap
m = Basemap(llcrnrlon=west, llcrnrlat=south, urcrnrlon=east, urcrnrlat=north,
            resolution='l', projection='tmerc', lat_ts=0,
            lon_0=center[0], lat_0=center[1])

# plot features
m.drawcoastlines()
m.drawcountries()
m.drawstates(color='w')
m.drawrivers(color='lightblue')
m.shadedrelief()

# plot point(s)
lons, lats = [47.3156], [11.422]
x, y = m(lons, lats)
m.scatter(x, y)
plt.text(x[0], y[0], 'You Are Here!', ha='center', va='bottom')

# show map
plt.show()

you_are_here.png

答案 1 :(得分:0)