Image attachments: capture GPS coordinates from Exif data
Description
Attachments could be of any supported files. However, image files, which in many practical cases originate from mobile devices, contain useful metadata. In order to take advantage of GPS coordinates, which can be present in images, entity Attachment and uploading of images as Attachment should be enhanced to capture GPS coordinates.
This information can be used at the level of TG-based application to associate domain entities with geo-locations by virtue of having images attached to them.
In addition, let's capture the date/time of when an photo was taken. This would be useful in practice, especially where photos get attached some time after they were taken. For example, if a photo of a broken fence, taken 2 months ago, is attached to a work activity, it could be important to see that the state of the fence is 2 months old.
Implementation details
-
[ ] 1. It is preferred to model the Exif data as a one-2-one association
AttachmentMetadatawith entityAttachment. The properties required are:latitude: BigDecimal(8,6),longitude: BigDecimal(8,6), anddateTime: DateTime(all optional). Make sure to save a new instance ofAttachmentMetadatawhen saving a new instance ofAttachment. -
[ ] 2. Entity
Attachmentshould have implicitly calculated propertymetadata: AttachmentMetadata. -
[ ] 3. The master for
Attachmentshould become compound, withAttachmentMetadatarepresented as menu itemMetadata. -
[ ] 4. Properties of
Attachment.metadatashould be added as selection criteria (as a subsection "Metadata") and the result set of the standard Attachment Centre.
Useful references
https://github.com/apache/commons-imaging https://github.com/apache/commons-imaging/blob/master/src/test/java/org/apache/commons/imaging/examples/MetadataExample.java
Expected outcome
GPS coordinates for image attachments, indicating their geo-location and providing opportunity for this information to be leveraged at the application level.