小编Ace*_*Ace的帖子

显示一个Shapefile

我有一个shapefile要显示。我尝试使用matplotlib来显示它,但是我得到了: 我得到什么 但是,当我尝试使用在线网站进行展示时,我得到了; 我想要的是

如何获得第二张图像?

这是我的代码:

import shapefile
import matplotlib.pyplot as plt

print("Initializing Shapefile")
sf = shapefile.Reader("ap_abl")
apShapes = sf.shapes()
points = apShapes[3].points
print("Shapefile Initialized")

print("Initializing Display")
fig = plt.figure()
ax = fig.add_subplot(111)
plt.xlim([78, 79])
plt.ylim([19, 20])
print("Display Initialized")

print("Creating Polygon")
ap = plt.Polygon(points, fill=False, edgecolor="k")
ax.add_patch(ap)
print("Polygon Created")

print("Displaying polygon")
plt.show()
Run Code Online (Sandbox Code Playgroud)

先感谢您。

python matplotlib shapefile python-3.x

3
推荐指数
2
解决办法
6035
查看次数

标签 统计

matplotlib ×1

python ×1

python-3.x ×1

shapefile ×1