geopandas形状文件坐标



我目前正在尝试从一组形状文件创建geojson文件。

for shape_file in shape_files[1:]:
print(fileName(shape_file))
shp = geopandas.read_file(shape_file)
shp.to_crs(epsg = '4326')
file_name = shape_file[0:len(shape_file) - len('.shp')] + '.geojson'
print(file_name)
print('Adding to JSON file')
shp.to_file(file_name, driver = 'GeoJSON')
print(fileName(file_name) + ' JSON file created.')
print()
print('DONE')

其中一个问题是坐标不是我想要使用的格式。

为了解决这个问题,我修改了代码来编辑坐标系,但现在我遇到了这个错误。

运行时错误:b'初始化列表中没有参数'

有什么建议吗?

要放入epsg的dtype不正确。如果你声明epsg,它必须是int。所以你的代码应该是这样的:
shp.to_crs(epsg = 4326)

shp.to_crs('epsg:4326')

最新更新