2 Star 4 Fork 3

汉塞大叔/Geospatial_Analysis_By_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
5.3 属性查询.py 519 Bytes
一键复制 编辑 原始数据 按行查看 历史
汉塞大叔 提交于 2021-01-20 19:53 +08:00 . 上传 py
import shapefile
r = shapefile.Reader("shapefiles/MS_UrbanAnC10/MS_UrbanAnC10")
w = shapefile.Writer("shapefiles/MS_UrbanAnC10/MS_Urban_Subset")
w.fields = list(r.fields)
for item in r.shapeRecords():
# 筛选人口小于5000,
if item.record[14] < 5000:
w.record(*item.record)
w.shape(item.shape)
r.close()
w.close()
# 验证结果
r = shapefile.Reader("shapefiles/MS_UrbanAnC10/MS_Urban_Subset")
for rec in r.shapeRecords():
print(rec.record[3], rec.record[14])
r.close()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/fengfeng233/geospatial_-analysis_-by_-python.git
git@gitee.com:fengfeng233/geospatial_-analysis_-by_-python.git
fengfeng233
geospatial_-analysis_-by_-python
Geospatial_Analysis_By_Python
master

搜索帮助