0
votes

Currently I'm trying to convert integer latitude and longitude to decimal (degrees). The specification from where I get the data says:

| Latitude | Position latitude | Integer, number of 1/10th of a second |

| Longitude | Position longitude | Integer, number of 1/10th of a second |

Here is a sample number:

  • Latitude: 1914383
  • Longitude: 371352

What I need, is something in this format:

  • Latitude: 51.39796
  • Longitude: 14.62539

How can I convert those formats?

I've seen a few implementations in c#, but nothing that was really usable for me, or I don't get how this might work. What I've tried:

Converting GPS coordinates (latitude and longitude) to decimal and Converting latitude and longitude to decimal values

Thanks a lot

1
As it is given in 1/10 sec, just divide it by 36000. Check how sign is forming in the API documentation.Sergey L

1 Answers

1
votes

Here is an example for the conversions between formats.

    private void ConvertSampleFunction()
    {
        //let N 40264600 be a GPS coordinate. Then
        //Format in degrees minutes seconds: 40° 26′ 46″ N 
        double Degs=40.0;
        double Mins=26.0;
        double Secs=46.00;
        //Then in degrees - decimal minutes Format will be
        double Ddegs=Degs;
        double Dmins=Mins;
        double Dsecs=Secs/60.0;
        //This will give Ddegs and Dmins.Dsecs e.g. 40 degrees and 26.767'
        //and In Decimal format DDD.DDD... it will be
        double DecDegs=Degs+Mins/60.0+Secs/3600.0;
        //which will give the value 40.446..
    }

Hope these help.