底图投影

问题描述 投票:0回答:2

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

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

matplotlib-basemap
2个回答
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


0
投票
© www.soinside.com 2019 - 2024. All rights reserved.