发布于 2009-06-15 04:07:47
原始格式以小时、分钟、秒为单位。若要转换为十进制,请执行:
D=H+ M/60 + s/3600
所以在你的例子中,37,14,6变成
37 + 14/60 + 6/3600 = 37.235,如前所述。
如果纬度为N,则结果为正,如果S为负。如果经度为E,则结果为正。如果是西方的话,结果是否定的。
发布于 2014-01-15 06:09:32
这里是Javascript函数,它完成了您所说的内容。
此实用工具允许用户在十进制与度、分钟和秒之间转换纬度和经度。为了方便起见,还提供了一个连接到国家大地测量局的NADCON程序,该程序允许在NAD83 / WGS84坐标系和旧的NAD27坐标系之间进行转换。NAD27坐标目前用于广播授权和应用程序。 此实用程序要求启用Javascript来执行计算。
发布于 2021-01-06 01:55:57
我的PHP代码来自这篇文章,谢谢!
function GetLatLon_FromExif($GPS){
$Lat_Ref = $GPS['GPSLatitudeRef'];
if($Lat_Ref == "S") { $Lat_Neg = "-"; }
$Lat_H = explode("/" ,$GPS['GPSLatitude']['0'])[0];
$Lat_M = explode("/" ,$GPS['GPSLatitude']['1'])[0];
$Lat_S = explode("/" ,$GPS['GPSLatitude']['2'])[0];
$Lat_S2 = explode("/" ,$GPS['GPSLatitude']['2'])[1];
$Lon_Ref = $GPS['GPSLongitudeRef'];
if($Lon_Ref == "W") { $Lon_Neg = "-"; }
$Lon_H = explode("/" ,$GPS['GPSLongitude']['0'])[0];
$Lon_M = explode("/" ,$GPS['GPSLongitude']['1'])[0];
$Lon_S = explode("/" ,$GPS['GPSLongitude']['2'])[0];
$Lon_S2 = explode("/" ,$GPS['GPSLongitude']['2'])[1];
$Lat = $Lat_H+($Lat_M/60)+(($Lat_S/$Lat_S2)/3600);
$Lon = $Lon_H+($Lon_M/60)+(($Lon_S/$Lon_S2)/3600);
return $Lat_Neg.$Lat.",".$Lon_Neg.$Lon;
}
JSON (来自图像EXIF):
"GPS": {
"GPSLatitudeRef": "N",
"GPSLatitude": [
"22/1",
"15/1",
"1708/100"
],
"GPSLongitudeRef": "W",
"GPSLongitude": [
"97/1",
"52/1",
"1882/100"
],
"GPSAltitudeRef": "\u0000",
"GPSAltitude": "9364/369",
"GPSSpeedRef": "K",
"GPSSpeed": "2203/12629",
"GPSImgDirectionRef": "T",
"GPSImgDirection": "52751/159",
"GPSDestBearingRef": "T",
"GPSDestBearing": "52751/159",
"UndefinedTag:0x001F": "6625/828"
}
https://stackoverflow.com/questions/995738
复制相似问题