2

4425.7819N 02607.5766Eなどの gps デバイス ウィッチ出力座標があります。

PHP を使用してそれらを通常の緯度と経度に変換するにはどうすればよいですか? 例えば。44.432395,26.125751

4

1 に答える 1

4

あなたの GPS デバイスは MinDec 形式で出力しているようです。

詳細については、 http://en.wikipedia.org/wiki/Geographic_coordinate_conversionの「MinDec から Decimal Degree への変換」を参照してください。

アップデート:

あなたのためにそれを変換するために私が書いた次の関数を見てください:

function convert($input)
{
    $input = ltrim($input, 0);
    $mCount = preg_match('/([0-9]{2})([^NESW]+)(N|E|S|W)/', $input, &$matches);
    if($mCount > 0)
    {
        $deg = intval($matches[1]);
        $degMin = floatval($matches[2]) / 60;
        $ret = $deg + $degMin;
        return ($matches[3] == 'S' || $matches[3] == 'W' ? '-' : '') . $ret;
    }
    return null;
}

var_dump(convert('4425.7819N'));
var_dump(convert('02607.5766E'));

それが役立つことを願っていますか?

于 2012-08-03T08:01:20.130 に答える