Questions tagged «degrees-minutes-seconds»

2
使用Field Calculator中的Python从DMS转换为DD?
我需要将表示为度,分和秒的纬度/经度转换为十进制度。例如,在数据中,它们在“纬度”列中列为N335042.06,在“经度”列中列为W86031.04。在创建将DMS转换为DD的脚本之前,我已经完成了此问题,反之亦然,所以我想我可以使用其中的位。但是我遇到的问题是如何忽略数据中的“ N”和“ W”(因为缺少一个更好的词)?我可以跳过它们吗?DMS一起列出,没有任何符号或空格。 我可以使用len(),range(),split()指定从值读哪一部分?例如,可以执行以下操作? N335042.06其中,33 =摄氏度50 =分钟42.06 =秒...? 我碰到过这篇 ESRI文章,但它在VB中。可能会将其用作参考,但是某些术语/语法与Python不同。 最终代码有效! # Pre-logic def latDD(x): D = int(x[1:3]) M = int(x[3:5]) S = float(x[5:]) DD = D + float(M)/60 + float(S)/3600 return DD # Expression latDD(!Latitude!)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.