安装GDAL
首先需要成功安装conda
,最好新建一个虚拟环境以防和其他包产生冲突
conda install -c conda-forge gdal
输入命令行后如果成功安装可以通过以下代码成功导入gdal
from osgeo import gdal
使用GDAL命令行转化坐标系
假设原始SHP文件名为input.shp
,目标文件为output.shp
,可通过以下命令进行转换:
ogr2ogr -t_srs "EPSG:4326" output.shp input.shp
如果出现报错:
Warning 1: One or several characters couldn’t be converted corre