我曾尝试在3.7版本上安装Geopython,但Fiona/GDAL在安装过程中失败惨重。接下来,我尝试使用shape reader查询文件并直接绘制点
虽然我在gis.StackOverflow(归功于user681)上的一个示例中取得了一些成功,但我使用了来自英国政府网站的shapefile。当我绘制边界时,我得到了可怕的点关联
我的密码在这里
import matplotlib.pyplot as plt
import numpy as np
import shapefile
ukmap = shapefile.Reader("./Archive/UK_map.shp")
txt_shapes = []
for ukmapshape in ukmap.shapes():
listx=[]
listy=[]
for x,y in ukmapshape.points:
listx.append(x)
listy.append(y)
txt_shapes.append([listx,listy])
for zone in txt_shapes:
x,y = zone
plt.plot(x,y)
plt.axis('equal')
plt.show()
问题是,这可能是点顺序,也就是我的文件,还是我的方法错了
您必须考虑形状的部分,其中包含以下部分的每个部分/起始索引的结束索引。 以下是对我有效的方法:
相关问题 更多 >
编程相关推荐