2024-05-14 19:00:39 发布
网友
python是否包含将DMS格式的纬度和经度转换为十进制格式的库,反之亦然?在
# -*- coding: latin-1 -*- #example for : 0°25'30"S, 91°7'W def conversion(old): direction = {'N':-1, 'S':1, 'E': -1, 'W':1} new = old.replace(u'°',' ').replace('\'',' ').replace('"',' ') new = new.split() new_dir = new.pop() new.extend([0,0,0]) return (int(new[0])+int(new[1])/60.0+int(new[2])/3600.0) * direction[new_dir] lat, lon = u'''0°25'30"S, 91°7'W'''.split(', ') print conversion(lat), conversion(lon) #Output: 0.425 91.1166666667
发件人:Python - Batch convert GPS positions to Lat Lon decimals
另一方面:
发件人:Lat Long to Minutes and Seconds?
发件人:Python - Batch convert GPS positions to Lat Lon decimals
另一方面:
^{pr2}$发件人:Lat Long to Minutes and Seconds?
相关问题 更多 >
编程相关推荐