2

(数据科学学习手札148)geopandas直接支持gdb文件写出与追加 - 费弗里

 1 year ago
source link: https://www.cnblogs.com/feffery/p/17025278.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

本文示例代码已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes

  大家好我是费老师,在我之前的某篇文章中为大家介绍过如何在windows系统上,基于ESRI FileGDB驱动为geopandas补充针对gdb文件的写出、追加功能,但那种方式既有些麻烦,又不支持linux等其他系统,局限性颇多,且经常会出现一些小问题。

  而随着近期geopandas底层依赖gdal的更新,使得我们可以在各种系统中直接利用geopandasgdb文件进行写出及追加操作,下面我们就来一睹为快~

1344061-20230104162806303-141415248.png

2 geopandas直接支持gdb文件写出与追加

  我们需要做的事只有一件,就是将我们环境中的gdal更新到3.6.0及以上版本,我的环境中原本的gdal版本为3.5.3,这时查看fiona.supported_drivers可以看到,OpenFileGDB对应的操作权限只有'r'即只读:

1344061-20230104162811236-1053878509.png

  我们使用conda install "gdal>=3.6.0" -c conda-forge -y来对gdal进行升级,可以看到随着gdal的升级,fiona中的OpenFileGDB权限更新为'raw',这意味着我们拥有了对gdb文件的读、写、追加操作能力:

1344061-20230104162814739-1666902258.png

  与我以前为大家介绍过的ESRI FileGDB驱动相比,新版OpenFileGDB针对gdb文件的读写速度更快更稳定,且支持直接读取zip格式的gdb压缩包,相当的方便🥳:

1344061-20230104162819139-1231464088.png

  并且这种开箱即用的方式适用于windowslinuxmac在内的各种常用操作系统,快升级你的gdal试试吧~


  以上就是本文的全部内容,欢迎在评论区与我进行讨论~


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK