Author Topic: Interpreting Latitude and Longitude in SON files?  (Read 9130 times)

0 Members and 1 Guest are viewing this topic.

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Interpreting Latitude and Longitude in SON files?
« on: May 08, 2013, 09:14:11 PM »
Hi All

I've been trying to build a batch converter to extract tracks and depths from several hundred DAT/SON files that I have. The info from this post http://forums.sideimagingsoft.com/index.php?topic=16.0 has been pretty much exactly what I need except for the interpretation of the Latitude and Longitude values. Using the byte map in the above thread I've been converting the Lat/Lon bytes using Int32 and getting values like Lon: 16226043 Lat: -4557743. I know they equate to 145.75528834210039 and -38.032398555522214 but don't know the conversion function or even if I'm doing the byte conversion correctly (I do the bit swap from Big to Little endian).

The DAT files come from a 998c HD SI Combo.

Anyone out there have the answer?

Adrian


Offline RGecy

  • Administrator
  • *
  • Joined: Mar 2009
  • Location: Beaufort, SC
  • Posts: 1981
    • SideImagingSoft.com
  • Unit(s): 1197c SI, 997c SI & 785c2
  • Software: 4.950 & 4.510
  • Accessories: Interlink & GRHA
Re: Interpreting Latitude and Longitude in SON files?
« Reply #1 on: May 09, 2013, 01:57:04 AM »
Adrian, of course I have the answer! ;D

I will post the code here tomorrow when i can.  The unit stores the coordinates in UTM not lat lon.  There are several good sources on the net that have these formulas, but getting the correct one can be tricky.  The datum multiplier is key to getting precise conversions.  Have a look at the webpage below and see what you think about the math.  ::) ::)

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


Robert
« Last Edit: May 09, 2013, 02:16:09 AM by RGecy »
Humminbird Guru and Forum Administrator

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #2 on: May 09, 2013, 02:16:07 AM »
ah Robert you're a legend . I had an idea they were in UTM but the numbers weren't right and there was no zone. Found some useful code at http://bb.sideimageforums.com/viewtopic.php?p=485 but that conversion was out by 0.7degrees.

Cheers

Adrian

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #3 on: May 09, 2013, 10:59:10 PM »
OK I can refine my problem a little more. I have code which coverts UTMtoDeg and DegtoUTM which works fine. The main issue I'm having is that the N & E from the SON file don't resemble the N & E for the true coordinates. I'm either converting them from bytes wrong or there is something done to the values before feeding them into the UTMtoDeg conversion. I'm assuming the UTM Zone is from common knowledge as I don't see it in the SON read out. So here is an example:

When I convert the SON bytes to Int32 I get N: -4557743 (position 20-23) and E: 16226043  (position 15-18)
The coordinates they should convert to is Lat: -38.03239969 Lon: 145.7552883 which in UTM is actually N: 5789858.812 (Raw N: -4210141.188) and E: 390763.6466 for Zone 55

So I guess what I need is the process to get those SON N&E correct before I convert to Lat/Lon.

Hope this makes it a bit easier to solve.

Adrian



Offline RGecy

  • Administrator
  • *
  • Joined: Mar 2009
  • Location: Beaufort, SC
  • Posts: 1981
    • SideImagingSoft.com
  • Unit(s): 1197c SI, 997c SI & 785c2
  • Software: 4.950 & 4.510
  • Accessories: Interlink & GRHA
Re: Interpreting Latitude and Longitude in SON files?
« Reply #4 on: May 10, 2013, 04:15:13 PM »
Might want to check how you are doing the bit swap.  You said from big to little endian, but the file is stored in big endian. 

So I would assume you are reading in litlle endian and converting to big endian.

Robert
« Last Edit: May 10, 2013, 06:26:20 PM by RGecy »
Humminbird Guru and Forum Administrator

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #5 on: May 13, 2013, 11:05:26 PM »
Robert

I'm reading the file's byte sections (big endian) into .NET and swapping the bits via Array.Reverse() to make it little endian which I then convert using BitConverter.ToInt32(). It seems to work fine for all the other data sections (date, depth, etc) in the line!?! The graphic show the basic output I'm getting for the first several lines. Some parts aren't converted to numeric datatypes.

I've used HumViewer to convert the same DAT file and it produces the correct lat/lons so I know the file should be fine. Could I send you the DAT/SON files to see if your code correctly interprets it? It's less than a Mb.

Cheers

Adrian

Offline RGecy

  • Administrator
  • *
  • Joined: Mar 2009
  • Location: Beaufort, SC
  • Posts: 1981
    • SideImagingSoft.com
  • Unit(s): 1197c SI, 997c SI & 785c2
  • Software: 4.950 & 4.510
  • Accessories: Interlink & GRHA
Re: Interpreting Latitude and Longitude in SON files?
« Reply #6 on: May 14, 2013, 10:48:12 PM »
Sure, send me the file. Or post it here.  You will need to zip it.

.Net will be reading it in Little Endian.  Either way, if you are reversing it, it wouldnt matter.  Like you said, it works for the other values.  It may be your conversion from UTM. 

Robert
« Last Edit: May 14, 2013, 10:51:20 PM by RGecy »
Humminbird Guru and Forum Administrator

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #7 on: May 15, 2013, 03:34:15 AM »
Yeah maybe something is wrong with the UTM conversion but I've also used the spread sheet at this link with the same results. http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM
All I know, that at least for the first line, the results should end up Lat: -38.03239969 Lon: 145.7552883. I've attached a zip of the DAT/SON files for you to have a look at.

Thanks heaps for this.

Adrian

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #8 on: May 27, 2013, 01:59:51 AM »
Hi Robert

Sorry to bug you but wondered if you managed to look at that DAT file? Mainly I want to know what Easting and Northing values you get out of it. If you get the same as me then my UTM conversion is the problem. If you get different Easting and Northing values to me then it's my binary conversion that's the problem.

Cheers

Adrian

Offline adriank

  • Newbie
  • *
  • Joined: Jul 2009
  • Location: Australia
  • Posts: 18
  • Unit(s): 997cSI and 998c SI
Re: Interpreting Latitude and Longitude in SON files?
« Reply #9 on: February 09, 2015, 06:23:35 PM »


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo

 

Related Topics

  Subject / Started by Replies Last post
9 Replies
7042 Views
Last post January 27, 2010, 09:15:37 AM
by rnvinc
9 Replies
7142 Views
Last post April 12, 2011, 02:42:29 PM
by Humminbird_Greg
27 Replies
12372 Views
Last post June 03, 2011, 08:04:40 PM
by sonar2000
4 Replies
4282 Views
Last post February 09, 2012, 11:28:09 AM
by sonar2000
2 Replies
3894 Views
Last post June 16, 2014, 04:41:35 PM
by nwifishnut
4 Replies
3826 Views
Last post October 16, 2014, 07:07:23 AM
by mmikos
1 Replies
3060 Views
Last post November 03, 2015, 09:15:00 PM
by rnvinc
2 Replies
6522 Views
Last post December 06, 2016, 09:17:49 AM
by trogersIII


SimplePortal 2.3.3 © 2008-2010, SimplePortal