GPS坐标翻译

发布于 2024-11-04 23:03:55 字数 932 浏览 0 评论 0原文

我正在使用 VisionTek 的型号为 86VT 的设备开发 GPS 跟踪网站

http://www.visiontek.co.in/vehicle-tracking-systems/86vt.html

我能够获取设备位置,但无法像我们在谷歌地图中使用的那样正确解析它。 为了。前任。我得到维沙卡帕特南的以下经度,在谷歌地图位置的原始坐标中为 17.xxx。

17480249N

我不知道这是什么格式,以及如何将 17480249N 转换为 17.xxx 。 我还知道“N”代表正值。

请帮忙,我正在使用 PHP,但任何逻辑都会受到赞赏。

这就是我从设备获取响应的方式。请参阅粗体文字了解坐标,我靠近维沙卡帕特南海滩。

$1,GlamourBik,14,11,10,14,40,08,17434800N,083185195E,02.1,13,0,0,A#

$2,GlamourBik,14,11,10,14,45,08,17440069N,083187747E,19.8,12,1,0,A#

$1,GlamourBik,14,11,10,16,53,42,17440319N,083176376E,00.3,178,1,0,A#

$1,GlamourBik,14,11,10,16,58,41,17440319N,083176376E,00.0,166,1,0,A#

$1,GlamourBik,14,11,10,17,03,42,17440319N,083176376E,00.0,42,1,0,A#

I am developing GPS tracking web site with a device from VisionTek with the model no 86VT

http://www.visiontek.co.in/vehicle-tracking-systems/86vt.html

I am able to get the device location but could not parse it correctly as we use in google maps.
For. Ex. I am getting the following longitude for Visakhapatnam which is 17.xxx in original Coordinate in google maps location.

17480249N

I dont know what is this format, and how to convert 17480249N to 17.xxx .
I also know that "N" is for positive values.

Please help, I am using PHP, but any logic will be appreciated.

This is how I am getting the response from device. Please see the bold text for coordinates, I am near to Visakhapatnam beach.

$1,GlamourBik,14,11,10,14,40,08,17434800N,083185195E,02.1,13,0,0,A#

$2,GlamourBik,14,11,10,14,45,08,17440069N,083187747E,19.8,12,1,0,A#

$1,GlamourBik,14,11,10,16,53,42,17440319N,083176376E,00.3,178,1,0,A#

$1,GlamourBik,14,11,10,16,58,41,17440319N,083176376E,00.0,166,1,0,A#

$1,GlamourBik,14,11,10,17,03,42,17440319N,083176376E,00.0,42,1,0,A#

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

书信已泛黄 2024-11-11 23:03:55

你确定这不是纬度? (N 应该表示北,经度表示东/西

在 javascript 中,这可能应该满足您的要求。

function getUsable ( coordinate ) 
{
  var signMultiplier = {'S':-1,'N':1, 'W':-1, 'E':1};
  var sign = coordinate[ coordinate.length-1 ];
  return signMultiplier[sign] * parseInt(coordinate.replace( sign, '' ), 10) / 1000000;
}

使用 getUsable('17480249N') 将返回 google-地图友好版本。

我假设格式是六位浮点精度的整数表示。

N 是正数,因为它表示北,而不是南,而南应该是负数。
E(东)和 W(西)相同。

演示位于 http://jsfiddle.net/gaby/Rjk8e/


更新

在更新完整坐标和 @wallyk 的答案后,这里是一个可以计算 DMS 格式坐标的版本。

function getUsableDMS( coordinate )
{
    var signMultiplier = {'S':-1,'N':1, 'W':-1, 'E':1};
    var sign = coordinate[ coordinate.length-1 ];
    var length = coordinate.length-1;
    var D = parseInt( coordinate.substr(0,(length==8)?2:3), 10 );
    var M = parseInt( coordinate.substr(2,2), 10 );
    var S = parseInt( coordinate.substr(4,4), 10 ) / 100;
  return signMultiplier[sign] * (D + (M/60) + (S/3600));
}

演示位于 http://jsfiddle.net/gaby/Rjk8e/1/


示例

是您问题中的第一个坐标 17434800N083185195E 中的任意一个(都在海中

位于谷歌地图使用第一种方法进行翻译

<一href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=17.729999999999997,%2083.54033055555556&aq=&sll=13.531665,87.53 9586&sspn=13.194946,17.753906&g=17.729999999999997,%2083.54033055555 556&ie=UTF8&ll=17.672811,83.251648&spn=1.619837,2.219238&z=9" rel="nofollow">Google 地图使用 DMS 方法进行翻译 ?

Are you sure it is not Latitude ? (N should mean North and Longitude is for East/West)

In javascript this should probably do what you want..

function getUsable ( coordinate ) 
{
  var signMultiplier = {'S':-1,'N':1, 'W':-1, 'E':1};
  var sign = coordinate[ coordinate.length-1 ];
  return signMultiplier[sign] * parseInt(coordinate.replace( sign, '' ), 10) / 1000000;
}

using getUsable('17480249N') will return the google-map friendly version.

I assume that the format is an integer representation of six digit floating precision.

N is positive because it denotes North as opposed to South which should be negative.
Same for E (east) and W (west).

Demo at http://jsfiddle.net/gaby/Rjk8e/


Update

After your update with full coordinates and the answer from @wallyk, here is a version that can calculate the coords if they are in DMS format.

function getUsableDMS( coordinate )
{
    var signMultiplier = {'S':-1,'N':1, 'W':-1, 'E':1};
    var sign = coordinate[ coordinate.length-1 ];
    var length = coordinate.length-1;
    var D = parseInt( coordinate.substr(0,(length==8)?2:3), 10 );
    var M = parseInt( coordinate.substr(2,2), 10 );
    var S = parseInt( coordinate.substr(4,4), 10 ) / 100;
  return signMultiplier[sign] * (D + (M/60) + (S/3600));
}

Demo at http://jsfiddle.net/gaby/Rjk8e/1/


Examples

Is the first coordinate in your question 17434800N, 083185195E located at any (both are in the sea) of

google map using translation by first method
or
google map using translation by DMS method ?

莫多说 2024-11-11 23:03:55

维萨卡帕特南 位于北纬 17° 42′,东经 83° 15′ 或,以有符号十进制 + 17.7°,+83.25°。由于维萨卡帕特南相当大,17480249可能意味着 17° 48' 2.49 ",距离 EESE 约 2.5 公里。

这就是 GPS 装置为 NMEA 0183 总线

将数量作为字符串处理。对于纬度,使用第一对数字作为度,第二对数字作为分,第三对数字作为秒,任何其他数字作为秒小数点后的数字 对于经度,使用前三位数字作为度,其余数字。数字与纬度的转换方式相同。

要将度、分和秒 (DMS) 转换为度,请使用公式 D + M/60.0 + S/3600.0

Visakhapatnam is located at 17° 42′ N, 83° 15′ E or, in signed decimal +17.7°, +83.25°. Since Visakapatnam is fairly large, 17480249 probably means 17° 48' 2.49 ", which is about 2.5 km away EESE.

This is how GPS units format their data for the NMEA 0183 bus, for example.

Handle the quantities as a string. For the latitude, use the first pair of digits as degrees, the second pair as minutes, the third pair as seconds, and any additional digits as digits after the seconds' decimal point. For longitude, use the first three digits as degrees, and the remaining digits the same way as latitude.

To convert degrees, minutes, and seconds (DMS) to degrees, use the formula D + M/60.0 + S/3600.0.

一枫情书 2024-11-11 23:03:55

该格式在此页面上不存在

http://en.wikipedia.org/wiki/Geographic_coordinate_conversion

我的建议多收集一些城市的数据,希望能从中找出规律。

That format is nowhere on this page

http://en.wikipedia.org/wiki/Geographic_coordinate_conversion

My suggestion is to collect some data for some more cities and hope that you can pick out a pattern.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文