【发布时间】:2022-01-23 14:37:37
【问题描述】:
我正在尝试使用 pysftp 的 getfo() 来读取 shapefile(无需下载)。但是,我得到的输出似乎不可行,我不确定它是否可以用 shapefile 做到这一点。
理想情况下,我想读入文件并将其转换为 Geopandas GeoDataFrame。
import pysftp
import io
with pysftp.Connection(host=myHostname, username=myUsername, password=myPassword, cnopts=cnopts) as sftp:
print("Connection established ... ")
# check files in directory
directory_structure = sftp.listdir('sites')
# Print data
for attr in directory_structure:
print(attr)
flo = io.BytesIO()
sites = sftp.getfo('sites/Sites.shp', flo)
value=flo.getvalue()
从这里我无法解码该值并且不确定如何继续。
【问题讨论】:
-
什么意思“似乎不可行”?您的代码甚至没有尝试对
value做任何事情。什么版本的 Python?