首页 > 编程语言 > 详细

【582】QGIS 矢量化 & Python 加载 shapefile

时间:2021-06-29 00:13:38      阅读:31      评论:0      收藏:0      [点我收藏+]

参考:QGIS创建矢量文件以及特殊矢量图形的画法

参考:Python 的一些练习(1)加载shapefile


 

一、QGIS 矢量化 (MAC)

  • Layer -> Create Layer -> New Shapefile Layer...
  • 技术分享图片
  • 选择存储位置、选择绘制的 shp 类型

 

二、Python 加载 shapefile 文件

import shapely, geopandas
tpath = ‘D:/shapefile/province.shp‘
 
shp_df = geopandas.GeoDataFrame.from_file(tpath,encoding = ‘gb18030‘)

shp_df.head()    # 获取表头
shp_df.plot()

  输出:

	id	geometry
0	0	POLYGON ((-1.41816 0.82393, -0.98349 0.81018, ...
1	1	POLYGON ((-0.39477 0.82118, 0.27923 0.77717, 0...
2	2	POLYGON ((0.75791 0.55708, 1.26135 0.39752, 1....
3	3	POLYGON ((-0.96974 0.21320, -0.24897 0.16094, ...
  • 每一个 geometry 类记录了一个 polygon 的 shapely 格式的文件
  • 通过 shapely polygon 可以进行其他操作了 

  技术分享图片

【582】QGIS 矢量化 & Python 加载 shapefile

原文:https://www.cnblogs.com/alex-bn-lee/p/14946174.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!