Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何对构造边界使用Basemap readshapefile方法_Python_Python 2.7_Matplotlib Basemap - Fatal编程技术网

Python 如何对构造边界使用Basemap readshapefile方法

Python 如何对构造边界使用Basemap readshapefile方法,python,python-2.7,matplotlib-basemap,Python,Python 2.7,Matplotlib Basemap,我不确定这里哪里出了问题,所以可能有人有在Basemap中使用readshapefile命令的经验可以提供帮助。下面是我的代码: m.readshapefile('/Users/MyiMac/Desktop/ONGOING_PROJEKTS/MISC/PB2/PB2002_plates', name='PB2002_plates', drawbounds=True, color='orange') 我想使用PB2002_plates.txt文件中的坐标来生成各种地图中的构造板块边界。使用我检索

我不确定这里哪里出了问题,所以可能有人有在Basemap中使用readshapefile命令的经验可以提供帮助。下面是我的代码:

m.readshapefile('/Users/MyiMac/Desktop/ONGOING_PROJEKTS/MISC/PB2/PB2002_plates', name='PB2002_plates', drawbounds=True, color='orange')
我想使用PB2002_plates.txt文件中的坐标来生成各种地图中的构造板块边界。使用我检索到的.txt文件不起作用。错误消息如下:

raise IOError('cannot locate %s.shx'%shapefile)
IOError: cannot locate /Users/MyiMac/Desktop/ONGOING_PROJEKTS/MISC/PB2/PB2002_plates.shx
错误提到找不到.shx文件。在另一个站点上,我找到了PB2002_plates.shp、PB2002_plates.sbn和PB2002_plates.sbx。我将所有这些文件放在与PB2002_plates.txt文件相同的目录中。我不知道要从哪个.shx文件或wehre中检索此文件。这3个“新”文件不是ASCII格式。PB2002_plates.txt包含坐标,因此采用ASCII格式


我不知道哪里出了问题,但我怀疑使用的文件类型是错误的。或者我需要在代码中为“name='PB2002_plates'使用不同类型的参数?或者是目录错误,并且需要更高一个目录,因为“name”参数是文件名?到目前为止,我发现的文献很少,网上的例子很少。

问题解决了。目录中必须有3种类型的PB2002文件,包括.shx文件,才能工作