Rod*_*gas 5 attributeerror python-3.x writetofile geopandas
GeoDataFrame我从 CSV 文件中获取了以下内容,并经过一些切片CRS和geometry分配
ctf_nom geometry id
0 Prunus mahaleb POINT (429125.795043319 4579664.7564311) 2616
1 Betula pendula POINT (425079.292045901 4585098.09043407) 940
2 Betula pendula POINT (425088.115045896 4585093.66943407) 940
3 Abelia triflora POINT (429116.661043325 4579685.93743111) 2002
4 Abies alba POINT (428219.962044021 4587346.66843531) 797
Run Code Online (Sandbox Code Playgroud)
我已经将 a 转换geometry为str:
from shapely import wkt
df['geometry'] = df['geometry'].apply(wkt.loads)
df_geo = gpd.GeoDataFrame(df, geometry = 'geometry')
Run Code Online (Sandbox Code Playgroud)
并通过以下方式分配了一个crs:
df_geo.crs = {'init' :'epsg:25831'}
df_geo.crs
Run Code Online (Sandbox Code Playgroud)
当我尝试再次按 gdf.to_file()函数保存减少的地理数据帧时,它返回以下属性错误:
AttributeError: 'Series' object has no attribute 'has_z'
我该如何解决这个问题?
您需要在以下位置显式设置几何列GeoDataFrame:
df_geo.set_geometry(col='geometry', inplace=True)
Run Code Online (Sandbox Code Playgroud)
摘自: https: //gis.stackexchange.com/a/342635/6998
| 归档时间: |
|
| 查看次数: |
1461 次 |
| 最近记录: |