Reading GPS info fails if GPSAltitude is not set
- Dominant language
- Rust
- Stars
- 88
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
The function [`gexiv2_metadata_get_gps_info`](https://gitlab.gnome.org/GNOME/gexiv2/blob/gexiv2-0.12.1/gexiv2/gexiv2-metadata-gps.cpp#L186) returns false if not all three coordinates (lat, lon, altitude) are set. This is a minor problem for gexiv2 because the `gexiv2_metadata_get_gps_longitude/latitude/altitude` functions exist separately. Of course, the tags can be accessed by name directly, but there are some important transformations done (see [this comment](https://gitlab.gnome.org/GNOME/gexiv2/blob/gexiv2-0.12.1/gexiv2/gexiv2-metadata-gps.cpp#L134) in gexiv2). So it is currently not possible to get reliable GPS information from rexiv2 directly if the altitude tag is not set.
It is quite common that the altitude is unset, the `examples/example.jpg` does not have this tag for example (so the example code fails).
Possible solutions:
1. Fix the example and show how to get latitude and longitude and do the necessary transformations (no API change).
2. Expose the `gexiv2_metadata_get_gps_longitude/latitude/altitude` functions (no breaking change).
2. Change the `GpsInfo` struct (most idiomatic).
Suggestion:
``` rust
pub struct GpsInfo {
pub longitude: f64,
pub latitude: f64,
pub altitude: Option,
}
```
Contributor guide
Assessment
This issue has not been assessed yet.