Convert from HEX to decimal Latitude and Longitude : Java
This is a discussion on Convert from HEX to decimal Latitude and Longitude within the Java forums in Programming Languages category; I have a binary file with coordinates in Latitude and Longitude how can I convert then to degrees? Byte 180-183 (Latitude) Hex 119c67 integer 18418791 Byte 184-187 (Longitude) Hex 0fbe72 integer 16508674 Decoded Decimal: Latitude 30.697985 Longitude 27.514457 Any help please. Thanx...
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| I convert then to degrees? Byte 180-183 (Latitude) Hex 119c67 integer 18418791 Byte 184-187 (Longitude) Hex 0fbe72 integer 16508674 Decoded Decimal: Latitude 30.697985 Longitude 27.514457 Any help please. Thanx |
|
#2
| |||
| |||
| <sazykin> wrote... >I have a binary file with coordinates in Latitude and Longitude > how can I convert then to degrees? First you should understand your data... It's very simple arithmetics. > > Byte 180-183 (Latitude) > Hex 119c67 integer 18418791 WRONG! You've lost a zero. Dec 18418791 = Hex 1190c67. > Byte 184-187 (Longitude) > Hex 0fbe72 integer 16508674 WRONG! You've lost a zero. Dec 16508674 = Hex fbe702. > Decoded Decimal: > Latitude 30.697985 > Longitude 27.514457 In the first angle there is the '6' digit at the first decimal place, so I suppose values are a simple decimal fractions rather than a degree-minute-second notation. Divide your known coordinate values by file-values to calculate the encoding scale, i.e. what angle is coded as a unit of your data: lat: 30.697985/18418791 = 1.666667e-6 = 1/600000 lon: 27.514457/16508674 = 1.666667e-6 = 1/600000 So your coordinates are simply stored as integers, expressed in 600000'ths of a degree. You need to decode 4 bytes as an integer and divide it by 600000.0 to get a value in degrees. However the sample you gave is too short to discover encoding for different hemispheres. If your data span both sides of the equator or the Greenwich meridian, they will probably be stored as positive and negative integers, for N/S and for E/W hemispheres, respectively -- but that should be verified. Maciek |
|
#3
| |||
| |||
| sazykin writes: > I have a binary file with coordinates in Latitude and Longitude how can > I convert then to degrees? > > Byte 180-183 (Latitude) > Hex 119c67 integer 18418791 > Byte 184-187 (Longitude) > Hex 0fbe72 integer 16508674 > Decoded Decimal: Latitude 30.697985 > Longitude 27.514457 Try dividing the integer result by 600000.0 -- Thomas A. Russ, USC/Information Sciences Institute |
|
#4
| |||
| |||
| I know this is an old thread, but I'm trying to solve the following puzzle and am stumped. Does anyone know how to convert the following Hex code to Latitude & Longitude coordinates? e9b2e3716f9499d345a437008f35f667 |
|
#5
| |||
| |||
| Hi guys, In case you need to convert a Hexadecimal to Decimal, use this hex to dec converter Hope this can help Regards, David |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get Latitude and Longitude from Tiff files | usenet | Idl-pvwave | 7 | 07-05-2007 02:26 AM |
| Get longitude and latitude from smart phone samsung blackjack? | usenet | DOTNET | 2 | 06-21-2007 11:41 PM |
| 3d displaying with x=longitude, y=latitude, z=altitude, but not yet working (T_T) | usenet | Idl-pvwave | 4 | 05-02-2007 05:17 PM |
| Map (Mercador) to Latitude / Longitude | usenet | Graphics | 7 | 06-29-2006 05:32 PM |
| MySQL query for WGS-84 longitude & latitude radius GPS distance calculation | usenet | basic.visual | 0 | 11-21-2005 03:01 AM |
All times are GMT -5. The time now is 08:55 AM.


