Help convert longitude

Help
2012-10-26
2013-06-12
  • Vicente Pita

    Vicente Pita - 2012-10-26

    hello I need help with logitude with this data package:
    (088046141136BR00121025A1256.7541S03828.8058W000.0174830132.3601000000L00001024)
    fis these functions;

      / * Parse individual fields * /
           
    / * Message identifier * /
    String s.substring ind = (12,14);

    int statusCode = StatusCodes.STATUS_LOCATION;
            ModemID s.substring String = (0.12);
            long yyyymmdd = StringTools.parseLong (s.substring (16.22), 0L);
            long hhmmss = StringTools.parseLong (s.substring (49.55), 0L);
            long fixtime = this._parseDate (yyyymmdd, hhmmss);
            validGPS s.substring boolean = (22,23). equals ("A");
            / / Double latitude = validGPS? StringTools.parseDouble (s.substring (23.33), 90.0): 0.0;
    / / Double longitude = validGPS? StringTools.parseDouble (s.substring (33.44) 180.0): 0.0;
    double _lat = validGPS? StringTools.parseDouble (s.substring (23.32), 0.0): 0.0;
    double _lon = validGPS? StringTools.parseDouble (s.substring (33.43), 0.0): 0.0;
    / / Ouble latitude = validGPS? StringTools.parseDouble (s.substring (23.32), 0.0): 0.0;
    / / Double longitude = validGPS? StringTools.parseDouble (s.substring (33.43), 0.0): 0.0;
    double heading = validGPS? StringTools.parseDouble (s.substring (55.60), 0.0): 0.0;
            double speedKPH = validGPS? StringTools.parseDouble (s.substring (44.49), 0.0): 0.0;
            double altitudeM = validGPS? StringTools.parseDouble (s.substring (60,63), 0.0): 0.0;
                 

            double lat = (double) ((long) _lat / 100L); / / _lat is always positive here
            = lat + (_lat - (lat * 100.0)) / 60;
            double latitude = lat;
    latSN s.substring boolean = (32,33). equals ("N");
    NS = char (latSN == true? 'N', 'S');
    / / Print.logInfo ("" + NS);
    = latitude (latSN == true? latitude: latitude-);

    double lon = (double) ((long) _lon / 100L); / / _lon is always positive here
            lon + = (_lon - (lon * 100.0)) / 60;
    = double length _lon;
            s.substring longEW = boolean (43,44). equals ("W");
    WE = char (longEW == true? 'W', 'E');
    / / Print.logInfo ("" + WE);
    longitude = (longEW == true?-longitude: longitude * 100.0) / 100;

    But the result is this;

    Device: 088046141136
    Latitude: -12.945901666666668
    Longitude: -38.288058

     
  • Vicente Pita

    Vicente Pita - 2012-10-26

    ok already corrected the error.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks