从十六进制数据GREENTEL转换回Latitude [英] Convert Back Latitude from Hex data GREENTEL

查看:160
本文介绍了从十六进制数据GREENTEL转换回Latitude的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在做一个基于Django和GREENTEL的GPS跟踪项目
它使用这个协议
http://www.m2msolution.eu/doc/Fejlesztoi_dokumentaciok/GT03/GPRS%20Communication%20Protocol_GT03.pdf



它说如何将纬度/经度转换为十六进制..但我想将纬度十六进制数据转换为标准格式


转换方法:A将纬度(度数,分钟)数据从
GPS模块转换为仅以分钟表示值的新形式;
B将转换后的值乘以30000,然后将结果
转换为十六进制数。例如22°32.7658',(22 * 60 + 32.7658)* 30000 =
40582974,然后将其转换为十六进制数字0x026B3F3E

如何将十六进制转换为纬度转换? 解决方案

首先获取十六进制,将其转换回10将结果除以60,整数部分为度数,其余为分钟数。



在python中:

  a = 0x026B3F3E 
b = a / 30000.0
度= b // 60
分钟= b%60

打印度,'度和',分钟,'分钟'
>>> 22.0度和32.7658分钟


Currently I am doing a GPS Tracking project based on Django and GREENTEL It uses this protocol http://www.m2msolution.eu/doc/Fejlesztoi_dokumentaciok/GT03/GPRS%20Communication%20Protocol_GT03.pdf

It says how to convert Latitude/ Longitude to Hex.. but I want to convert latitude hex data to the normal form

Conversion method: A Convert the latitude (degrees, minutes) data from GPS module into a new form which represents the value only in minutes; B Multiply the converted value by 30000, and then transform the result to hexadecimal number. For example 22°32.7658′,(22*60+32.7658)*30000 = 40582974,then convert it to hexadecimal number 0x026B3F3E

how to reverse the hex to latitude conversion?

解决方案

First you get the hex, convert it back to base 10 and divide it by 30000.

Get the result and divide it by 60, the integer part will be the degrees, the rest will be the minutes.

In python:

a = 0x026B3F3E
b = a/30000.0
degrees = b//60
minutes = b%60

print degrees, ' degrees and ', minutes, 'minutes'
>>> 22.0  degrees and  32.7658 minutes

这篇关于从十六进制数据GREENTEL转换回Latitude的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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