Python-地理数据 (Python - Geographical Data)
Many open source python libraries now have been created to represent the geographical maps. They are highly customizable and offer a varierty of maps depicting areas in different shapes and colours. One such package is Cartopy. You can download and install this package in your local environment from Cartopy. You can find numerous examples in its gallery.
现在已经创建了许多开源python库来表示地理地图。 它们是高度可定制的,并提供各种地图,以不同的形状和颜色描述区域。 一种这样的包装是Cartopy。 您可以从Cartopy在本地环境中下载并安装此软件包。 您可以在其画廊中找到许多示例。
In the below example we show a portion of the world map showing parts of Asia and Australia. You can adjust the values of the parameters in the method set_extent to locate different areas of world map.
在下面的示例中,我们显示了世界地图的一部分,其中显示了亚洲和澳大利亚的部分地区。 您可以在set_extent方法中调整参数值以查找世界地图的不同区域。
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
# make the map global rather than have it zoom in to
# the extents of any plotted data
ax.set_extent((60, 150, 55, -25))
ax.stock_img()
ax.coastlines()
ax.tissot(facecolor='purple', alpha=0.8)
plt.show()
Its output is as follows −
其输出如下-
翻译自: https://www.tutorialspoint.com/python_data_science/python_geographical_data.htm