geopandas无法正确读取geojson [英] geopandas cannot read a geojson properly

查看:199
本文介绍了geopandas无法正确读取geojson的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以下操作:

下载 http://eric.clst.org/assets后,/wiki/uploads/Stuff/gz_2010_us_050_00_20m.json

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

在页面上 http://eric.clst.org/tech/usgeojson/在20m列下有4个geojson文件,上面的文件对应于US Counties行,并且是唯一无法从4个行中读取的文件.错误消息不是非常有用,我想知道是什么原因,请?

On the page http://eric.clst.org/tech/usgeojson/ with 4 geojson files under the 20m column, the above file corresponds to the US Counties row, and is the only one that cannot be read out of the 4. The error message isn't very informative, I wonder what's the reason, please?

推荐答案

如果您的错误消息看起来像多边形和MultiPolygons应该遵循正确的规则",则表示这些GeoObject中坐标的顺序应该是时钟-明智的.

If your error message looks anything like "Polygons and MultiPolygons should follow the right-hand rule", it means the order of the coordinates in those GeoObjects should be clock-wise.

这是一个在线工具,可以修复"您的对象,并提供简短说明:

Here's an online tool to "fix" your objects, with a short explanation:

https://mapster.me/right-hand-rule-geojson-修复程序/

这篇关于geopandas无法正确读取geojson的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆