【发布时间】:2015-10-29 15:02:30
【问题描述】:
我从 US Census 下载了 shapefile 格式的地图。它包含我需要的所有必需信息,但出于某种原因,我需要一张特定的地图,它给了我这个错误:
Traceback (most recent call last):
File "C:/Users/Leb/Desktop/Python/Kaggle/mapp.py", line 17, in <module>
shp_info = m.readshapefile('gis/cb_2014_us_state_5m', 'states', drawbounds=True)
File "C:\Program Files\Python 3.5\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 2162, in readshapefile
raise ValueError('readshapefile can only handle 2D shape types')
ValueError: readshapefile can only handle 2D shape types
更具体地说,these 文件集给了我错误。如您所见,我下载了5m 分辨率shapefile。
这是我用来执行命令的代码:
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
m = Basemap(llcrnrlon=-119, llcrnrlat=22, urcrnrlon=-64, urcrnrlat=49,
projection='lcc', lat_1=33, lat_2=45, lon_0=-95)
shp_info = m.readshapefile('gis/cb_2014_us_state_5m', 'states', drawbounds=True)
问题:
- 我需要通过
Fiona转换它吗?或ArcGIS?为了 将其更改为正确的格式。 - 有没有更好的替代
basemap?
【问题讨论】:
-
你解决了吗?
标签: python matplotlib matplotlib-basemap