从英国坐标转换为标准WGS84 nmea [英] Convert from British coordinates to standard WGS84 nmea

查看:606
本文介绍了从英国坐标转换为标准WGS84 nmea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经发布了类似的帖子。我从理论上得到了答案,但我确实需要somone来帮助我。



所以我使用这个查看当我有学位时我需要获得什么十进制值我没有得到相同的值。



这是我应该得到的价值:


这是我在程序中获得的价值:


46.64662666666667


为什么我无法获得相同的转换? / p>

解决方案

ParseNMEA函数中的以下行是从WGS84转换到英国法令调查坐标的那一行:

  return Transform(deciLat,deciLon,height); 

因此,如果您删除该行并使用deciLat和deciLon值,则应该没问题...



问题更新后添加:



不考虑本地数字格式,所以如果出现这种情况,可能是因为错误的十进制符号匹配。



您可以使用以下函数进行转换,假设输入总是在不变的文化中(带有小数点):

$ $ $ $ $ $ c $ string $ arrLon = strLon.Split(new char [] {'°','''},StringSplitOptions.RemoveEmptyEntries);
double dblLon = double.Parse(arrLon [0])+ double.Parse(arrLon [1],new System.Globalization.NumberFormatInfo ))/ 60;
double deciLon = arrLon [2] ==E?dblLon: - dblLon;

其他信息:

NumberFormatInfo: http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx


I was posting similar post already. And I did get an answer in theory but I really need somone to help me.

So I am using this EXAMPLE for testing my GPS. What I want to do is how to get standard decimal values like 56,322415 for latitude and longitude. Because now I am getting 5304,254 value.

I need it in this form because I will use this for Google maps.

Can you check code and tell me what should I left out or how to convert it to WGS84 format.

Thank you.

EDIT:

Here is the picture that is explaining what I see when I run the program

And this is the one that is one the codeproject page:

EDIT 2:

So when I use THIS CONVERTER to see what decimal values I need to get when I have degrees I don't get the same values.

This is the value that I should get :

And this is the value that I get in the program:

46.64662666666667

Any idea why I can't get same conversion?

解决方案

the following line in the ParseNMEA function is the one that does the conversion from WGS84 to the British Ordinance Survey coordinates:

return Transform(deciLat, deciLon, height);

so if you remove that line and just use deciLat and deciLon values, you should be fine...

Addition after question update:

The code you're referring to does not take local number formats into account, so if this goes wrong, it might be because of erroneous decimal symbol matching.

You can use the following functions to do the conversion, presuming the input is always in the invariant culture (with decimal points):

string[] arrLon = strLon.Split(new char[]{'°', '"'}, StringSplitOptions.RemoveEmptyEntries);
double dblLon = double.Parse(arrLon[0]) + double.Parse(arrLon[1], new System.Globalization.NumberFormatInfo()) / 60;
double deciLon = arrLon[2] == "E" ? dblLon : - dblLon;

Additional info:

NumberFormatInfo: http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx

这篇关于从英国坐标转换为标准WGS84 nmea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆