Convert Back Latitude from Hex data GREENTEL(从十六进制数据转换回纬度 GREENTEL)
问题描述
目前我正在做一个基于 Django 和 GREENTEL 的 GPS 跟踪项目它使用这个协议http://www.m2msolution.eu/doc/Fejlesztoi_dokumentaciok/GT03/GPRS%20Communication%20Protocol_GT03.pdf
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
转换方法:A 将纬度(度、分)数据从GPS模块变成了一种新的形式,仅以分钟为单位表示值;B 将转换后的值乘以 30000,然后转换结果为十六进制数.例如22°32.7658′,(22*60+32.7658)*30000 =40582974,然后将其转换为十六进制数0x026B3F3E
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?
推荐答案
首先你得到十六进制,将它转换回以 10 为底,然后除以 30000.
First you get the hex, convert it back to base 10 and divide it by 30000.
得到结果并除以60,整数部分为度数,其余为分钟数.
Get the result and divide it by 60, the integer part will be the degrees, the rest will be the minutes.
在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从十六进制数据转换回纬度 GREENTEL


基础教程推荐
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 筛选NumPy数组 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01