Objectmix
Tags Register Mark Forums Read

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...


Object Mix > Programming Languages > Java > Convert from HEX to decimal Latitude and Longitude

Reply

 

LinkBack Thread Tools
  #1  
Old 08-14-2006, 07:42 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Convert from HEX to decimal Latitude and Longitude

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

  #2  
Old 08-14-2006, 08:51 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Convert from HEX to decimal Latitude and Longitude


<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  
Old 08-14-2006, 04:09 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Convert from HEX to decimal Latitude and Longitude

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  
Old 06-05-2009, 09:22 AM
Junior Member
 
Join Date: Jun 2009
Posts: 1
tiggy00 is on a distinguished road
Default Re: Convert from HEX to decimal Latitude and Longitude

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  
Old 01-07-2010, 05:43 AM
Junior Member
 
Join Date: Jan 2010
Posts: 2
davitz38 is on a distinguished road
Default Re: Convert from HEX to decimal Latitude and Longitude

Hi guys,
In case you need to convert a Hexadecimal to Decimal, use this hex to dec converter
Hope this can help
Regards,
David
Reply

Thread Tools


Similar Threads

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.

Managed by Infnx Pvt Ltd.