如何将GeodataFrame下载到我的本地驱动器上,从Google Colab下载?
我对 SHAPEFiles 和 GeoDataFrames 相当陌生,所以如果这是一个非常基本的问题,我深表歉意。
我在 Mac 上的 Google Chrome 中使用 Google Colab。 Python 版本 3.xx
我有一个现有的 Esri SHAPEFile,其中包含多边形和多多边形的 CRS 点(纬度-经度)。
我的目标是找到这些多边形和多多边形的质心,并将质心添加为现有 SHAPE 文件中的新列,然后在本地保存文件。
如何将文件保存到本地?我使用什么格式? 谢谢。
I am fairly new to SHAPEFiles and GeoDataFrames so apologies if this is a very basic question.
I am using Google Colab in Google Chrome on a Mac. Python version 3.xx
I have an existing Esri SHAPEFile that has CRS points (latitiude-longitude) of Polygons and MultiPolygons.
My objective was to find the centroid of these Polygons and MultiPolygons and add the centroids as a new column in the existing SHAPEfile and then save the file locally.
How do I save the file locally? What format do I use?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要刷新 Google Colabs 中的工作目录才能查看 shapefile。确保您也下载了所有关联的文件。
注意:您不能在一个 shapefile 中存储多个几何图形。
该脚本使用几何形状的质心创建一个新的 shapefile,但也保留所有其他列。这样您就能够关联两个数据集。
以下是一个可能的工作流程:
polygons.zip
centroids.zip
PS。对于这种情况,我建议使用本地 Jupyter 笔记本和 Python 环境。
You'll need to refresh your working directory in Google Colabs to see the shapefile. Make sure you download all associated files as well.
Note: You cannot store more than one geometry in a shapefile.
The script creates a new shapefile using the centroids for the geometries but also keeping all other columns. That way you will be able to relate both datasets.
Here is a possible workflow:
polygons.zip
in my examplecentroids.zip
PS. I would recommend to use a local Jupyter notebook and Python environment for such situations.