这些 GPS 数据是什么意思,如何将它们正确转换为十进制度数?

What are these GPS data mean, and how to correctly convert them into decimal degrees?

我有一组家用GPS坐标数据,excel sheet中的格式如下(出于保密原因编辑):

    ID    GPSN   GPSS   GPSE   GPSW
    1    211234   -9   890123   -9
    2    211255   -9   890155   -9
    ...

我的问题是:这是哪种 GPS 坐标(看起来像 UTM 数据)?如何准确地将它们转换为仅包含经度和纬度(或 X、Y 数据)的十进制度数?我是否需要某种分区信息才能正确执行此操作?谢谢

我怀疑 GPS 接收器是否会输出 UTM 坐标。在我看来,它像 degrees/minutes/seconds (DDMMSS) 中的纬度和经度。如果是这样,那么一种方法就是下面的简单 Python。 ArcGIS 中的 Convert Coordinate Notation tool 可能有用,但您必须先重新格式化数据,可能使用 Python.

import csv
import sys

# A function that takes 211234, treats it as 21°12'34",
# and returns 21.209444.
def convertToDegrees(DMS):
    dms = DMS
    dms = int(dms)
    seconds = dms % 100
    if 60 <= seconds:
        print "More than 60 seconds! " + str(DMS) + " is not degrees/minutes/seconds!"
    dms /= 100
    minutes = dms % 100
    if 60 <= minutes:
        print "More than 60 minutes! " + str(DMS) + " is not degrees/minutes/seconds!"
    dms -= minutes
    degrees = dms / 100
    degrees += (minutes / 60.0)
    degrees += (seconds / (60.0 * 60.0))
    if 180 < degrees or -180 > degrees:
        print "In " + str(DMS) + ", degrees is outside [-180, 180]: " + str(degrees)
    return degrees

# Input and output files from command line parameters
inFilename = sys.argv[1]
outFilename = sys.argv[2]
readFirstRow = False
with open(inFilename, "rb") as inFile:
    reader = csv.reader(inFile)
    with open(outFilename, "wb") as outFile:
        writer = csv.writer(outFile)

        # Loop through the rows
        for row in reader:
            if (not readFirstRow):
                # Write the header row only once
                writer.writerow(["ID", "latitude", "longitude"])
                readFirstRow = True
            else:
                # Convert this row to latitude and longitude
                latitude = 0
                longitude = 0
                if "-9" != row[1]:
                    latitude = convertToDegrees(row[1])
                if "-9" != row[2]:
                    latitude = -1 * convertToDegrees(row[2])
                if "-9" != row[3]:
                    longitude = convertToDegrees(row[3])
                if "-9" != row[4]:
                    longitude = -1 * convertToDegrees(row[4])
                writer.writerow([row[0], latitude, longitude])

为确保正确,您需要确认 GPS 正在输出纬度和经度并找出它使用的数据(可能是 WGS 1984)。