字节转经纬度

/初始化

byte[] bLat = new byte[4];  

//调用

string latStr = this.LngLatByte2Float(bLat).ToString();    //lat

//实现

public float LngLatByte2Float(byte[] b)
{
if (b.Length != 4) return 0;

int d = 0x00;
for (int i = 0; i < b.Length; i++)
{
d |= (b[b.Length - i - 1] << (8 * i));
}

//将int值转换成小数表示的经纬度
d /= 3;
int intPart = d / (60 * 10000);
int divPart = d - intPart * 60 * 10000; //余数部分
float floatPart = ((float)divPart) / 600000;

return intPart + floatPart;
}

原文地址:https://www.cnblogs.com/wdw31210/p/9680012.html