-
Notifications
You must be signed in to change notification settings - Fork 6
/
coord_converter_all.py
52 lines (36 loc) · 1.39 KB
/
coord_converter_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'''
投影shp文件
'''
import geopandas as gpd
# import time
import argparse
from gooey import Gooey
from gooey import GooeyParser
@Gooey(program_name='投影小程序')
def proj_shp_file():
'''
将输入的带有空间坐标系的文件转换到另外一个空间坐标系下
Parameters:
------------------
in_shp_path: str
输入的带有空间坐标系的文件(原始空间坐标系由输入文件中获取)
out_shp_path: str
输出路径
out_epsg: int
目标空间坐标系的epsg标记
'''
parser = GooeyParser(description='将带有空间坐标系的文件(shp)投影到任意其它坐标系')
group = parser.add_argument_group('必须参数',gooey_options={'show_border': False})
group.add_argument('in_shp_path', help='输入的带有空间坐标系的文件', widget='FileChooser')
group.add_argument('out_shp_path', help='输出路径', widget='DirChooser')
group.add_argument('out_epsg', help='目标空间坐标系的epsg标记')
args = parser.parse_args()
# print(args.out_epsg)
# begin_tick = time.time()
tmp = gpd.GeoDataFrame.from_file(args.in_shp_path)
# print(tmp.crs)
tmp_proj = tmp.to_crs({'init': 'epsg:4326'})
tmp_proj.to_file(args.out_shp_path, encoding='utf-8')
# print('elapse {} '.format(time.time() - begin_tick))
if __name__ == '__main__':
proj_shp_file()