September 1st 2014, Qt GPS Camera
← September 1st 2014 Qt Swipe Camera | ● | September 2014 Sardinia Vacation →
My regular LG Smartphone camera app is able to embed the GPS location as EXIF tag into the captured images.
With QML this is accomplished by using the camera.imageCapture.setMetaData(key, value) method with keys “GPSLatitude” and “GPSLongitude”. Unfortunately those do not appear to work on Android with Qt 5.3. It appears to work on Linux, though.
With the upcoming Qt 5.4 release the QML Camera has been extended with metaData fields for GPSLatitude, GPSLongitude etc. as defined by the EXIF format:
This suggests that the setMetaData() issue will be addressed with Qt 5.4.
So for the moment we just wait until the Qt 5.4 release comes out to get proper GPS EXIF tag support. In the meantime we can excercise getting the actual GPS location with QML. The following QML snippet does the job. It emits the location(lat, lon, h, time) signal for each position the gps device senses:
id: gps
signal location(double lat, double lon, double h, date timestamp)
preferredPositioningMethods: PositionSource.SatellitePositioningMethods
updateInterval: 1000 // ms
active: true
onPositionChanged: {
var coord = gps.position.coordinate;
location(coord.latitude, coord.longitude, coord.altitude, gps.position.timestamp);
console.log("Lat/Lon/H:", coord.latitude, coord.longitude, coord.altitude);
}
}
← September 1st 2014 Qt Swipe Camera | ● | September 2014 Sardinia Vacation →