예제 #1
0
def add_lat_lon_general(test_obj, filename):

    test_latitude = 50.5475894785
    test_longitude = 15.595866685
    precision = 1e7

    empty_exifedit = ExifEdit(filename)

    empty_exifedit.add_lat_lon(test_latitude, test_longitude, precision)
    empty_exifedit.write(EMPTY_EXIF_FILE_TEST)

    exif_data = load_exif()
    exif_gps_info = exif_data[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]]

    test_obj.assertEqual(
        (
            decimal_to_dms(abs(test_latitude), precision),
            decimal_to_dms(abs(test_longitude), precision),
            "N",
            "E",
        ),
        (
            rational_to_tuple(
                exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLatitude"]]),
            rational_to_tuple(
                exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLongitude"]]),
            exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLatitudeRef"]],
            exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLongitudeRef"]],
        ),
    )
예제 #2
0
    def test_add_negative_lat_lon(self):

        test_latitude = -50.5
        test_longitude = -15.5
        precision = 1e7

        empty_exifedit = ExifEdit(EMPTY_EXIF_FILE_TEST)

        empty_exifedit.add_lat_lon(test_latitude, test_longitude, precision)
        empty_exifedit.write(EMPTY_EXIF_FILE_TEST)

        exif_data = load_exif()
        self.assertEqual((decimal_to_dms(abs(test_latitude), precision), decimal_to_dms(abs(test_longitude), precision), "S", "W"),
                         (exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLatitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLongitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLatitudeRef']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLongitudeRef']]))
예제 #3
0
def add_lat_lon_general(test_obj, filename):

    test_latitude = 50.5475894785
    test_longitude = 15.595866685
    precision = 1e7

    empty_exifedit = ExifEdit(filename)

    empty_exifedit.add_lat_lon(test_latitude, test_longitude, precision)
    empty_exifedit.write(EMPTY_EXIF_FILE_TEST)

    exif_data = load_exif()
    test_obj.assertEqual((decimal_to_dms(abs(test_latitude), precision), decimal_to_dms(abs(test_longitude), precision), "N", "E"),
                         (exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLatitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLongitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLatitudeRef']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLongitudeRef']]))
예제 #4
0
    def test_add_negative_lat_lon(self):

        test_latitude = -50.5
        test_longitude = -15.5
        precision = 1e7

        empty_exifedit = ExifEdit(EMPTY_EXIF_FILE_TEST)

        empty_exifedit.add_lat_lon(test_latitude, test_longitude, precision)
        empty_exifedit.write(EMPTY_EXIF_FILE_TEST)

        exif_data = load_exif()
        self.assertEqual((decimal_to_dms(abs(test_latitude), precision), decimal_to_dms(abs(test_longitude), precision), "S", "W"),
                         (exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLatitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLongitude']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']
                                    ][EXIF_GPS_TAGS_DICT['GPSLatitudeRef']],
                          exif_data[EXIF_PRIMARY_TAGS_DICT['GPSInfo']][EXIF_GPS_TAGS_DICT['GPSLongitudeRef']]))
예제 #5
0
    def test_add_negative_lat_lon(self):
        test_latitude = -50.5
        test_longitude = -15.5
        precision = 1e7

        empty_exifedit = ExifEdit(EMPTY_EXIF_FILE_TEST)

        empty_exifedit.add_lat_lon(test_latitude, test_longitude, precision)
        empty_exifedit.write(EMPTY_EXIF_FILE_TEST)

        exif_data = load_exif()
        exif_gps_info = exif_data[EXIF_PRIMARY_TAGS_DICT["GPSInfo"]]

        assert decimal_to_dms(
            abs(test_latitude), precision) == rational_to_tuple(
                exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLatitude"]])
        assert decimal_to_dms(
            abs(test_longitude), precision) == rational_to_tuple(
                exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLongitude"]])
        assert "S" == exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLatitudeRef"]]
        assert "W" == exif_gps_info[EXIF_GPS_TAGS_DICT["GPSLongitudeRef"]]