3

私はいくつかの画像処理コードを書いていて、GPS 座標を引き出していますが、度/分/秒または 10 進形式に変換する方法がわからないある種の整数配列になっています。

Lat: (38,0,0,0,1,0,0,0,54,0,0,0,1,0,0,0,168,73,5,0,16,39,0,0)
Lng: (77,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,60,122,0,0,16,39,0,0)

Windows によると、これの D/M/S バージョンは次のとおりです。

ここに画像の説明を入力

VB.NET コードが最も役に立ちますが、おそらくどの言語からでも変換できます。

4

2 に答える 2

3

.NET 呼び出しを使用して C# で動作するコードを次に示します (VB で実行するのは簡単です)。

Double deg = (Double)BitConverter.ToInt32(data,0)/ BitConverter.ToInt32(data,4);
Double min = (Double)BitConverter.ToInt32(data,8)/ BitConverter.ToInt32(data,12);
Double sec = (Double)BitConverter.ToInt32(data,16)/ BitConverter.ToInt32(data,20);

フォーマットはここに文書化されています http://en.wikipedia.org/wiki/Geotagging

于 2013-10-03T04:55:35.400 に答える
0

配列は次の形式で配置されます。

bytes(0 -> 3) / bytes(4 -> 7) = degree
(bytes(8 -> 11) / bytes(12 -> 15)) / 60= minute
(bytes(16 -> 19) / bytes(20 -> 23)) / 3600 = second

*注 - 各byte(x -> y)数量は範囲の合計です。

以下は、指定された緯度配列を 10 進数形式にデコードします。

    Dim coord(5) As Decimal
    Dim j As Integer = 0
    Dim coordinate As Decimal

    For i As Integer = 0 To lat.Length - 1
        coord(j) = coord(j) + lat(i)

        'If i is a multiple of 4, goto the next index
        If ((i + 1) Mod 4 = 0) And i <> 0 Then
            j += 1
        End If

    Next

    coordinate = (coord(0) / coord(1)) + ((coord(2) / coord(3))) / 60 + ((coord(4) / coord(5)) / 3600)

参照される配列を変更して lng をデコードするだけです。

于 2013-10-03T04:56:27.043 に答える