微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将 Fieldalytics API 检索到的数据加载到 GeoPandas 中?

如何解决如何将 Fieldalytics API 检索到的数据加载到 GeoPandas 中?

我从 Fieldalytics API 检索了地理边界数据:

y = getBoundary(fieldboundary)
print(y)

({'type': 'polygon','坐标': [[[-109.308557510376,51.5768561748859],[-109.285554885864,51.5768295045241],[-109.285640716553,51.562505259384],[-1509],[-105 51.5624785806018],[-109.308557510376,51.5768561748859]]]},'https://api.efcsystems.com/boundary/ff2bf689-908f-4d17-bd59-183c16758e23?format=geojson&srid=4326&api_partner_guid=...&private_key=...')

然后我尝试将其加载到 GeoPandas 中:

import geopandas
d = geopandas.read_file(y[0])

我收到以下错误消息:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-59-0eb61a9b6cc3> in <module>
      1 import geopandas
----> 2 d = geopandas.read_file(y[0])
      3 
      4 
      5 #d.plot()

~/anaconda3/lib/python3.8/site-packages/geopandas/io/file.py in _read_file(filename,bBox,mask,rows,**kwargs)
    158 
    159     with fiona_env():
--> 160         with reader(path_or_bytes,**kwargs) as features:
    161 
    162             # In a future Fiona release the crs attribute of features will

~/anaconda3/lib/python3.8/site-packages/fiona/env.py in wrapper(*args,**kwargs)
    398     def wrapper(*args,**kwargs):
    399         if local._env:
--> 400             return f(*args,**kwargs)
    401         else:
    402             if isinstance(args[0],str):

~/anaconda3/lib/python3.8/site-packages/fiona/__init__.py in open(fp,mode,driver,schema,crs,encoding,layer,vfs,enabled_drivers,crs_wkt,**kwargs)
    251             path = Parsedpath(path,archive,scheme)
    252         else:
--> 253             path = parse_path(fp)
    254 
    255         if mode in ('a','r'):

~/anaconda3/lib/python3.8/site-packages/fiona/path.py in parse_path(path)
    130         return Unparsedpath(path)
    131 
--> 132     elif path.startswith('/vsi'):
    133         return Unparsedpath(path)
    134 

AttributeError: 'dict' object has no attribute 'startswith'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。