Ignore:
Timestamp:
2008-08-21T00:47:19+02:00 (16 years ago)
Author:
stoecker
Message:

fix import error in NMEA. Closes #1433.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r738 r814  
    6060                TIME(1),
    6161                /** Warning from the receiver (A = data ok, V = warning) */
    62                 RECEIVER_WARNING(2), WIDTH_NORTH(3), WIDTH_NORTH_NAME(4), LENGTH_EAST(5), LENGTH_EAST_NAME(
    63                         6),
     62                RECEIVER_WARNING(2),
     63                WIDTH_NORTH(3), WIDTH_NORTH_NAME(4),
     64                LENGTH_EAST(5), LENGTH_EAST_NAME(6),
    6465                /** Speed in knots */
    6566                SPEED(7), COURSE(8), DATE(9),
     
    168169
    169170                int latdeg = Integer.parseInt(widthNorth.substring(0, 2));
     171                double latmin = Double.parseDouble(widthNorth.substring(2));
     172                double lat = latdeg + latmin / 60;
    170173                if ("S".equals(e[GPRMC.WIDTH_NORTH_NAME.position])) {
    171                         latdeg = -latdeg;
    172                 }
    173                 double latmin = Double.parseDouble(widthNorth.substring(2));
     174                        lat = -lat;
     175                }       
    174176
    175177                int londeg = Integer.parseInt(lengthEast.substring(0, 3));
     178                double lonmin = Double.parseDouble(lengthEast.substring(3));
     179                double lon = londeg + lonmin / 60;
    176180                if ("W".equals(e[GPRMC.LENGTH_EAST_NAME.position])) {
    177                         londeg = -londeg;
     181                        lon = -lon;
    178182                }
    179                 double lonmin = Double.parseDouble(lengthEast.substring(3));
    180 
    181                 return new LatLon(latdeg + latmin / 60, londeg + lonmin / 60);
     183               
     184                return new LatLon(lat, lon);
    182185        }
    183186}
Note: See TracChangeset for help on using the changeset viewer.