Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat gps lat long #677

Merged
merged 8 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions lib/src/exif/ifd_directory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,66 @@ class IfdDirectory {
data[0x8298] = IfdValueAscii(value);
}
}

bool get hasGPSLatitudeRef => data.containsKey(0x0001);
String? get gpsLatitudeRef => data[0x0001]?.toString();
set gpsLatitudeRef(String? value) {
if (value == null) {
data.remove(0x0001);
} else {
data[0x0001] = IfdValueAscii(value);
}
}

bool get hasGPSLatitude => data.containsKey(0x0002);
double? get gpsLatitude => data[0x0002]?.toDouble();
set gpsLatitude(double? value) {
if (value == null) {
data.remove(0x0002);
} else {
data[0x0002] = IfdValueDouble(value);
}
}

bool get hasGPSLongitudeRef => data.containsKey(0x0003);
String? get gpsLongitudeRef => data[0x0003]?.toString();
set gpsLongitudeRef(String? value) {
if (value == null) {
data.remove(0x0003);
} else {
data[0x0003] = IfdValueAscii(value);
}
}

bool get hasGPSLongitude => data.containsKey(0x0004);
double? get gpsLongitude => data[0x0004]?.toDouble();
set gpsLongitude(double? value) {
if (value == null) {
data.remove(0x0004);
} else {
data[0x0004] = IfdValueDouble(value);
}
}

void setGpsLocation({
required double latitude,
required double longitude,
}) {
gpsLatitude = latitude.abs();
gpsLongitude = longitude.abs();
gpsLatitudeRef = latitude < 0.0 ? 'S' : 'N';
gpsLongitudeRef = longitude < 0.0 ? 'W' : 'E';
}


bool get hasGPSDate => data.containsKey(0x001D);
String? get gpsDate => data[0x001D]?.toString();
set gpsDate(String? value) {
if (value == null) {
data.remove(0x001D);
} else {
data[0x001D] = IfdValueAscii(value);
}
}

}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: image
version: 4.3.0
version: 4.3.1
description: >-
Dart Image Library provides server and web apps the ability to load, manipulate,
and save images with various image file formats.
Expand Down
Loading