其他分享
首页 > 其他分享> > Bidirectional UTM_to_WGS84

Bidirectional UTM_to_WGS84

作者:互联网

 1 import utm
 2 import numpy as np
 3 from shapely.wkt import dumps, loads
 4 outfile = "D:/研究/课题资料/申请后提交/验收-准备/coding4-yanshou/data_vec_output/inputTIF.out"
 5 # outfile: LINESTRING (112.87052724867623 32.780393689498865, 112.87060585126358 32.78038236059359, 112.87071589488588 32.7803445975656, 112.87077653116756 32.780337044958074)
 6 
 7 with open(outfile, 'r') as output:
 8     for line_wkt_str in output.readlines():
 9         lr = loads(line_wkt_str)
10         lon_arr, lat_arr = np.array(lr.xy[0]), np.array(lr.xy[1])
11         print(lon_arr), print(lat_arr)
12 
13         # latlon_2_utm
14         easting, northing, zone_number, zone_letter = utm.from_latlon(latitude=lat_arr, longitude=lon_arr)
15         print(easting, northing, zone_number, zone_letter)
16         # utm_2_latlon
17         latitude, longitude = utm.to_latlon(easting, northing, zone_number, zone_letter)
18         print(longitude, latitude)

UTM.zone_number(UTM zone numbers), UTM.zone_letter(UTM zone designators) can be found in url: http://www.jaworski.ca/utmzones.htm

标签:latlon,arr,WGS84,zone,number,utm,Bidirectional,UTM
来源: https://www.cnblogs.com/jeshy/p/15345088.html