geopandas无法正确读取geojson

geopandas无法正确读取geojson,pandas,geojson,geopandas,Pandas,Geojson,Geopandas,我正在尝试以下方法: 下载后 [2]中的:导入geopandas 在[3]中:geopandas.read_文件('./gz_2010_us_050_00_20m.json')) --------------------------------------------------------------------------- TypeError回溯(最近一次调用上次) 在里面 ---->1 geopandas.read_文件('./gz_2010_us_050_00_20m.json'))

我正在尝试以下方法:

下载后

[2]中的
:导入geopandas
在[3]中:geopandas.read_文件('./gz_2010_us_050_00_20m.json'))
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在里面
---->1 geopandas.read_文件('./gz_2010_us_050_00_20m.json'))
read_文件中的~/miniconda3/envs/ml3/lib/python3.6/site-packages/geopandas/io/file.py(文件名,**kwargs)
24其他:
25 f_filt=f
--->26 gdf=GeoDataFrame.from_特征(f_过滤器,crs=crs)
27
28#使用元数据中的列顺序重新排序,最后是几何图形
~/miniconda3/envs/ml3/lib/python3.6/site-packages/geopandas/geodataframe.py位于from_要素(cls、要素、crs)中
207
208行=[]
-->209对于特征中的f _lst:
210如果hasattr(f),“地理界面”:
211 f=f.\U地理位置\U接口__
菲奥娜中的菲奥娜/OGRXX.PYX。
菲奥娜中的菲奥娜/OGRXX.PYX
TypeError:startswith first arg必须是字节或字节元组,而不是str

在20m列下有4个geojson文件的页面上,上面的文件对应于US Countries行,并且是4个文件中唯一无法读取的文件。错误消息的信息量不大,我想知道原因是什么?

如果您的错误消息看起来像“多边形和多面体应遵循右手规则”,这意味着这些地理对象中的坐标顺序应按时钟顺序

以下是一个在线工具,用于“修复”您的对象,并附有简短说明:


可能是对到达此页面的人的回答,我收到了相同的错误,并且由于编码问题引发了错误

尝试使用utf-8编码初始文件,或者尝试使用您认为应用于该文件的编码打开该文件。这修正了我的错误


更多信息

例如,QGIS可以读取文件吗?是的,QGIS可以打开文件错误消息是否类似于“多边形和多面体应遵循右手规则”?因为如果是这样,这意味着你应该在多边形/多边形中对坐标进行排序。@oriash,我不确定这是否是问题所在。但你们如何排序坐标,按纬度还是按液化天然气?顺时针。应该行。你知道更具伸缩性的修复程序吗?
In [2]: import geopandas
In [3]: geopandas.read_file('./gz_2010_us_050_00_20m.json')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-83a1d4a0fc1f> in <module>
----> 1 geopandas.read_file('./gz_2010_us_050_00_20m.json')

~/miniconda3/envs/ml3/lib/python3.6/site-packages/geopandas/io/file.py in read_file(filename, **kwargs)
     24         else:
     25             f_filt = f
---> 26         gdf = GeoDataFrame.from_features(f_filt, crs=crs)
     27 
     28         # re-order with column order from metadata, with geometry last

~/miniconda3/envs/ml3/lib/python3.6/site-packages/geopandas/geodataframe.py in from_features(cls, features, crs)
    207 
    208         rows = []
--> 209         for f in features_lst:
    210             if hasattr(f, "__geo_interface__"):
    211                 f = f.__geo_interface__

fiona/ogrext.pyx in fiona.ogrext.Iterator.__next__()

fiona/ogrext.pyx in fiona.ogrext.FeatureBuilder.build()

TypeError: startswith first arg must be bytes or a tuple of bytes, not str