diff -Nru josm-0/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java josm-0.metadata-extractor2.7.2/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
|
old
|
new
|
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | try { |
| 617 | | double speed = dirGps.getDouble(GpsDirectory.TAG_GPS_SPEED); |
| 618 | | String speedRef = dirGps.getString(GpsDirectory.TAG_GPS_SPEED_REF); |
| | 617 | double speed = dirGps.getDouble(GpsDirectory.TAG_SPEED); |
| | 618 | String speedRef = dirGps.getString(GpsDirectory.TAG_SPEED_REF); |
| 619 | 619 | if (speedRef != null) { |
| 620 | 620 | if (speedRef.equalsIgnoreCase("M")) { |
| 621 | 621 | // miles per hour |
| … |
… |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | try { |
| 635 | | double ele = dirGps.getDouble(GpsDirectory.TAG_GPS_ALTITUDE); |
| 636 | | int d = dirGps.getInt(GpsDirectory.TAG_GPS_ALTITUDE_REF); |
| | 635 | double ele = dirGps.getDouble(GpsDirectory.TAG_ALTITUDE); |
| | 636 | int d = dirGps.getInt(GpsDirectory.TAG_ALTITUDE_REF); |
| 637 | 637 | if (d == 1) { |
| 638 | 638 | ele *= -1; |
| 639 | 639 | } |
| … |
… |
|
| 666 | 666 | // 1) GPS_TIME_STAMP not set -> date/time will be null |
| 667 | 667 | // 2) GPS_DATE_STAMP not set -> use EXIF date or set to default |
| 668 | 668 | // 3) GPS_TIME_STAMP and GPS_DATE_STAMP are set |
| 669 | | int[] timeStampComps = dirGps.getIntArray(GpsDirectory.TAG_GPS_TIME_STAMP); |
| | 669 | int[] timeStampComps = dirGps.getIntArray(GpsDirectory.TAG_TIME_STAMP); |
| 670 | 670 | if (timeStampComps != null) { |
| 671 | 671 | int gpsHour = timeStampComps[0]; |
| 672 | 672 | int gpsMin = timeStampComps[1]; |
| … |
… |
|
| 675 | 675 | |
| 676 | 676 | // We have the time. Next step is to check if the GPS date stamp is set. |
| 677 | 677 | // dirGps.getString() always succeeds, but the return value might be null. |
| 678 | | String dateStampStr = dirGps.getString(GpsDirectory.TAG_GPS_DATE_STAMP); |
| | 678 | String dateStampStr = dirGps.getString(GpsDirectory.TAG_DATE_STAMP); |
| 679 | 679 | if (dateStampStr != null && dateStampStr.matches("^\\d+:\\d+:\\d+$")) { |
| 680 | 680 | String[] dateStampComps = dateStampStr.split(":"); |
| 681 | 681 | cal.set(Calendar.YEAR, Integer.parseInt(dateStampComps[0])); |
diff -Nru josm-0/src/org/openstreetmap/josm/tools/ExifReader.java josm-0.metadata-extractor2.7.2/src/org/openstreetmap/josm/tools/ExifReader.java
|
old
|
new
|
|
| 124 | 124 | */ |
| 125 | 125 | public static LatLon readLatLon(GpsDirectory dirGps) throws MetadataException { |
| 126 | 126 | if (dirGps != null) { |
| 127 | | double lat = readAxis(dirGps, GpsDirectory.TAG_GPS_LATITUDE, GpsDirectory.TAG_GPS_LATITUDE_REF, 'S'); |
| 128 | | double lon = readAxis(dirGps, GpsDirectory.TAG_GPS_LONGITUDE, GpsDirectory.TAG_GPS_LONGITUDE_REF, 'W'); |
| | 127 | double lat = readAxis(dirGps, GpsDirectory.TAG_LATITUDE, GpsDirectory.TAG_LATITUDE_REF, 'S'); |
| | 128 | double lon = readAxis(dirGps, GpsDirectory.TAG_LONGITUDE, GpsDirectory.TAG_LONGITUDE_REF, 'W'); |
| 129 | 129 | return new LatLon(lat, lon); |
| 130 | 130 | } |
| 131 | 131 | return null; |
| … |
… |
|
| 158 | 158 | */ |
| 159 | 159 | public static Double readDirection(GpsDirectory dirGps) { |
| 160 | 160 | if (dirGps != null) { |
| 161 | | Rational direction = dirGps.getRational(GpsDirectory.TAG_GPS_IMG_DIRECTION); |
| | 161 | Rational direction = dirGps.getRational(GpsDirectory.TAG_IMG_DIRECTION); |
| 162 | 162 | if (direction != null) { |
| 163 | 163 | return direction.doubleValue(); |
| 164 | 164 | } |