【问题标题】:Python updated political map of India with state boundariesPython 用州界更新了印度的政治地图
【发布时间】:2020-07-30 20:16:14
【问题描述】:

谁能帮我绘制最近的印度政治地图,其中还包括州界? 底图或地图中的默认地图不包括争议区域和州边界。 我现在的代码是

import cartopy as ccrs
import matplotlib.pyplot as plt
import cartopy.feature as cfeature
fig, ax = plt.subplots(subplot_kw=dict(projection=ccrs.crs.PlateCarree()))
ax.set_extent([67.0, 98.0, 5.0, 38.0])
gl = ax.gridlines(crs=ccrs.crs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5,
                  linestyle='--')
gl.xlabels_top = False
gl.ylabels_right = False
ax.coastlines(color='black', linewidth=1, resolution='10m')
ax.add_feature(cfeature.BORDERS.with_scale('10m'),
               linestyle='-', alpha=.5)

【问题讨论】:

  • 除了你的链接,如果你想要一张正确的印度地图,按照宪法规定,查谟和克什米尔的边界,你可以试试这个链接:indianremotesensing.com/2017/01/…

标签: python matplotlib gis matplotlib-basemap cartopy


【解决方案1】:

你可以使用

ax.add_feature(cfeature.STATES.with_scale('10m'),
               linestyle='-', alpha=.5, color='red')

绘制州边界,但这将绘制所有国家的州。

注意:奇怪的是,当使用比例“50m”时,只有美国、巴西和澳大利亚州被抽签。

如果您需要特定国家/地区的数据,最好的方法是从GADM 下载 shapefile。下载并解压 India 文件后,您可以像这样绘制:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import cartopy.feature as cfeature
from cartopy.io.shapereader import Reader
from cartopy.feature import ShapelyFeature

fig, ax = plt.subplots(subplot_kw=dict(projection=ccrs.PlateCarree()))
ax.set_extent([67.0, 98.0, 5.0, 38.0])
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=1, color='gray', alpha=0.5,
                  linestyle='--')
gl.xlabels_top = False
gl.ylabels_right = False
ax.coastlines(color='black', linewidth=1, resolution='10m')
ax.add_feature(cfeature.BORDERS.with_scale('50m'),
               linestyle='-', alpha=.5)

# ax.add_feature(cfeature.STATES.with_scale('10m'),
#                linestyle='-', alpha=.5, color='red')

fname = '/tmp/india/gadm36_IND_1.shp'
shape_feature = ShapelyFeature(Reader(fname).geometries(),
                               ccrs.PlateCarree(), edgecolor='red')
ax.add_feature(shape_feature)

_0 是国家级,_1 是州级,依此类推。但我不知道有争议的地区是如何呈现的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多