我正在尝试 GPS 应用程序,我想将十进制数字转换为纬度/经度,但我没有找到确切的解决方案。我在下面尝试过
string decimalToLatLong(decimal lat,decimal refPoint)
{
bool isNeg = lat < 0;
int d = (int)lat;
int m = (int)((lat - d) * 60);
decimal s = ((((lat - d) * 60) - m) * 60);
return (d+m+s).ToString("00.000");
if (isLat)
direction = isNeg ? "S" : "N";
else
direction = isNeg ? "W" : "E";
}